Compare commits

..

12 Commits

Author SHA1 Message Date
John Preston
5c9c836857 Version 3.4.3: Fix build with GCC. 2022-01-04 00:01:56 +03:00
John Preston
31b7fe6ba0 Version 3.4.3.
- Bug fixes and other minor improvements.
2022-01-03 20:04:53 +03:00
John Preston
102c0a96ed Re-enable XWayland by default on GNOME.
Should fix #17457, fix #17468, fix #17476, fix #17477, fix #1747,
fix #17481, fix #17498.
2022-01-03 20:03:06 +03:00
John Preston
9a0be43ef5 Align reactions outside of the bubble. 2022-01-03 20:00:18 +03:00
John Preston
c1d948ef63 Reshuffle chat menus. 2022-01-03 18:16:19 +03:00
John Preston
9df229a230 Add pinned message icon.
Regression was introduced in 1af2cfe143.

Fixes #17489.
2022-01-03 18:15:36 +03:00
John Preston
a1c342c822 Leave only one style of the reaction button. 2022-01-03 15:30:17 +03:00
John Preston
c313cfb4ec Don't show empty context menu. 2022-01-03 14:47:05 +03:00
John Preston
8d4a658d0b Use mirrors for freedesktop.org repositories. 2022-01-03 14:14:26 +03:00
John Preston
86f53d3eff Fix crash after comments button destruction.
Regression was introduced in df66162bca.
2022-01-03 11:40:42 +03:00
John Preston
3cb89339c8 Version 3.4.2: Fix build for Mac App Store. 2021-12-31 23:40:36 +03:00
John Preston
ba98a8df32 Version 3.4.2: Fix build with GCC. 2021-12-31 23:32:53 +03:00
25 changed files with 512 additions and 525 deletions

View File

@@ -440,7 +440,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_settings_phone_label" = "Phone number";
"lng_settings_username_add" = "Add username";
"lng_settings_close_sure" = "Are you sure you want to close this page? You didn't save your changes.";
//"lng_settings_peer_to_peer" = "Peer-to-Peer";
"lng_settings_peer_to_peer_about" = "Disabling peer-to-peer will relay all calls through Telegram servers to avoid revealing your IP address, but may slightly decrease audio quality.";
"lng_settings_advanced" = "Advanced";
"lng_settings_stickers_emoji" = "Stickers and emoji";
@@ -917,8 +916,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_profile_files_header" = "Files";
"lng_profile_audios#one" = "{count} voice message";
"lng_profile_audios#other" = "{count} voice messages";
//"lng_profile_rounds#one" = "{count} video message";
//"lng_profile_rounds#other" = "{count} video messages";
"lng_profile_audios_header" = "Voice messages";
"lng_profile_shared_links#one" = "{count} shared link";
"lng_profile_shared_links#other" = "{count} shared links";
@@ -978,8 +975,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_media_selected_file#other" = "{count} Files";
"lng_media_selected_audio#one" = "{count} Voice message";
"lng_media_selected_audio#other" = "{count} Voice messages";
//"lng_media_selected_round#one" = "{count} Video message";
//"lng_media_selected_round#other" = "{count} Video messages";
"lng_media_selected_link#one" = "{count} Shared link";
"lng_media_selected_link#other" = "{count} Shared links";
"lng_media_photo_empty" = "No photos here yet";
@@ -1729,7 +1724,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_context_send_message" = "Send message";
"lng_context_view_group" = "View group info";
"lng_context_view_channel" = "View channel info";
//"lng_context_view_feed_info" = "View feed info";
"lng_context_hide_psa" = "Hide this announcement";
"lng_context_pin_to_top" = "Pin to top";
"lng_context_unpin_from_top" = "Unpin from top";
@@ -1745,6 +1739,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_context_archive_to_list" = "Move to chats list";
"lng_context_archive_to_menu_info" = "Archive moved to the main menu!\nYou can return it from the context menu of the archive button.";
"lng_context_mute" = "Mute notifications";
"lng_context_unmute" = "Unmute";
"lng_context_promote_admin" = "Promote to admin";
"lng_context_edit_permissions" = "Edit permissions";
"lng_context_restrict_user" = "Restrict user";

View File

@@ -10,7 +10,7 @@
<Identity Name="TelegramMessengerLLP.TelegramDesktop"
ProcessorArchitecture="ARCHITECTURE"
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
Version="3.4.2.0" />
Version="3.4.3.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 3,4,2,0
PRODUCTVERSION 3,4,2,0
FILEVERSION 3,4,3,0
PRODUCTVERSION 3,4,3,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -62,10 +62,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "Telegram FZ-LLC"
VALUE "FileDescription", "Telegram Desktop"
VALUE "FileVersion", "3.4.2.0"
VALUE "FileVersion", "3.4.3.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2021"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "3.4.2.0"
VALUE "ProductVersion", "3.4.3.0"
END
END
BLOCK "VarFileInfo"

View File

@@ -35,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 3,4,2,0
PRODUCTVERSION 3,4,2,0
FILEVERSION 3,4,3,0
PRODUCTVERSION 3,4,3,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", "3.4.2.0"
VALUE "FileVersion", "3.4.3.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2021"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "3.4.2.0"
VALUE "ProductVersion", "3.4.3.0"
END
END
BLOCK "VarFileInfo"

View File

@@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "platform/platform_launcher.h"
#include "platform/platform_specific.h"
#include "platform/linux/linux_desktop_environment.h"
#include "base/platform/base_platform_info.h"
#include "base/platform/base_platform_file_utilities.h"
#include "ui/main_queue_processor.h"
@@ -59,7 +60,12 @@ FilteredCommandLineArguments::FilteredCommandLineArguments(
pushArgument("cocoa:fontengine=freetype");
#endif // !Q_OS_WIN
}
#endif // Q_OS_WIN || Q_OS_MAC
#elif defined Q_OS_UNIX
if (Platform::DesktopEnvironment::IsGnome()) {
pushArgument("-platform");
pushArgument("xcb;wayland");
}
#endif // Q_OS_WIN || Q_OS_MAC || Q_OS_UNIX
pushArgument(nullptr);
}

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 = 3004002;
constexpr auto AppVersionStr = "3.4.2";
constexpr auto AppVersion = 3004003;
constexpr auto AppVersionStr = "3.4.3";
constexpr auto AppBetaVersion = false;
constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION;

View File

@@ -593,6 +593,7 @@ void Widget::checkUpdateStatus() {
Core::checkReadyUpdate();
App::restart();
});
_connecting->raise();
} else {
if (!_updateTelegram) return;
_updateTelegram.destroy();

View File

@@ -382,7 +382,7 @@ void HistoryItem::setIsPinned(bool pinned) {
id));
}
if (changed) {
history()->owner().requestItemResize(this);
history()->owner().notifyItemDataChange(this);
}
}

View File

@@ -479,18 +479,6 @@ HistoryWidget::HistoryWidget(
Window::ActivateWindow(controller);
});
controller->adaptive().changes(
) | rpl::start_with_next([=] {
if (_history) {
_history->forceFullResize();
if (_migrated) {
_migrated->forceFullResize();
}
updateHistoryGeometry();
update();
}
}, lifetime());
session().data().newItemAdded(
) | rpl::start_with_next([=](not_null<HistoryItem*> item) {
newItemAdded(item);
@@ -2151,6 +2139,16 @@ void HistoryWidget::showHistory(
object_ptr<HistoryInner>(this, _scroll, controller(), _history));
_list->show();
controller()->adaptive().changes(
) | rpl::start_with_next([=] {
_history->forceFullResize();
if (_migrated) {
_migrated->forceFullResize();
}
updateHistoryGeometry();
update();
}, _list->lifetime());
if (_chooseForReport && _chooseForReport->active) {
_list->setChooseReportReason(_chooseForReport->reason);
}
@@ -2243,6 +2241,12 @@ void HistoryWidget::setHistory(History *history) {
return;
}
unregisterDraftSources();
if (_history) {
_history->forceFullResize();
}
if (_migrated) {
_migrated->forceFullResize();
}
_history = history;
_migrated = _history ? _history->migrateFrom() : nullptr;
registerDraftSource();

View File

@@ -159,6 +159,17 @@ void BottomInfo::paint(
authorEditedWidth,
outerWidth);
if (_data.flags & Data::Flag::Pinned) {
const auto &icon = inverted
? st->historyPinInvertedIcon()
: stm->historyPinIcon;
right -= st::historyPinWidth;
icon.paint(
p,
right,
firstLineBottom + st::historyPinTop,
outerWidth);
}
if (!_views.isEmpty()) {
const auto viewsWidth = _views.maxWidth();
right -= st::historyViewsSpace + viewsWidth;
@@ -367,6 +378,9 @@ QSize BottomInfo::countOptimalSize() {
+ _replies.maxWidth()
+ st::historyViewsWidth;
}
if (_data.flags & Data::Flag::Pinned) {
width += st::historyPinWidth;
}
_reactionsMaxWidth = countReactionsMaxWidth();
width += _reactionsMaxWidth;
return QSize(width, st::msgDateFont->height);
@@ -410,6 +424,9 @@ BottomInfo::Data BottomInfoDataFromMessage(not_null<Message*> message) {
if (item->isSponsored()) {
result.flags |= Flag::Sponsored;
}
if (item->isPinned() && message->context() != Context::Pinned) {
result.flags |= Flag::Pinned;
}
if (const auto msgsigned = item->Get<HistoryMessageSigned>()) {
if (!msgsigned->isAnonymousRank) {
result.author = msgsigned->author;

View File

@@ -35,6 +35,7 @@ public:
Sending = 0x04,
RepliesContext = 0x08,
Sponsored = 0x10,
Pinned = 0x20,
//Unread, // We don't want to pass and update it in Date for now.
};
friend inline constexpr bool is_flag_type(Flag) { return true; };

View File

@@ -937,7 +937,6 @@ void Message::paintFromName(
const auto nameText = [&]() -> const Ui::Text::String * {
const auto from = item->displayFrom();
const auto service = (context.outbg || item->isPost());
const auto sponsored = service && item->isSponsored();
const auto st = context.st;
if (from) {
p.setPen(!service
@@ -1846,11 +1845,7 @@ Reactions::ButtonParameters Message::reactionButtonParameters(
using namespace Reactions;
auto result = ButtonParameters{ .context = data()->fullId() };
const auto outbg = hasOutLayout();
result.style = (!_comments && !embedReactionsInBubble())
? ButtonStyle::Service
: outbg
? ButtonStyle::Outgoing
: ButtonStyle::Incoming;
const auto outsideBubble = (!_comments && !embedReactionsInBubble());
const auto geometry = countGeometry();
result.pointer = position;
const auto onTheLeft = (outbg && !delegate()->elementIsChatWide());
@@ -1865,7 +1860,7 @@ Reactions::ButtonParameters Message::reactionButtonParameters(
const auto innerHeight = geometry.height()
- keyboardHeight
- reactionsHeight;
const auto maybeRelativeCenter = (result.style == ButtonStyle::Service)
const auto maybeRelativeCenter = outsideBubble
? media()->reactionButtonCenterOverride()
: std::nullopt;
const auto addOnTheRight = [&] {
@@ -2153,10 +2148,6 @@ bool Message::toggleSelectionByHandlerClick(
return false;
}
bool Message::displayPinIcon() const {
return data()->isPinned() && !isPinnedContext();
}
bool Message::hasFromName() const {
switch (context()) {
case Context::AdminLog:
@@ -2791,8 +2782,9 @@ int Message::resizeContentGetHeight(int newWidth) {
if (item->repliesAreComments() || item->externalReply()) {
newHeight += st::historyCommentsButtonHeight;
} else {
} else if (_comments) {
_comments = nullptr;
checkHeavyPart();
}
newHeight += viewButtonHeight();
} else if (mediaDisplayed) {
@@ -2806,6 +2798,9 @@ int Message::resizeContentGetHeight(int newWidth) {
: contentWidth;
newHeight += st::mediaInBubbleSkip
+ _reactions->resizeGetHeight(reactionsWidth);
if (hasOutLayout() && !delegate()->elementIsChatWide()) {
_reactions->flipToRight();
}
}
if (const auto keyboard = item->inlineReplyKeyboard()) {

View File

@@ -221,7 +221,6 @@ private:
[[nodiscard]] bool displayFastShare() const;
[[nodiscard]] bool displayGoToOriginal() const;
[[nodiscard]] ClickHandlerPtr fastReplyLink() const;
[[nodiscard]] bool displayPinIcon() const;
void refreshInfoSkipBlock();
[[nodiscard]] int plainMaxWidth() const;

View File

@@ -23,9 +23,7 @@ namespace {
constexpr auto kToggleDuration = crl::time(80);
constexpr auto kActivateDuration = crl::time(150);
constexpr auto kExpandDuration = crl::time(150);
constexpr auto kInCacheIndex = 0;
constexpr auto kOutCacheIndex = 1;
constexpr auto kServiceCacheIndex = 2;
constexpr auto kBgCacheIndex = 0;
constexpr auto kShadowCacheIndex = 0;
constexpr auto kEmojiCacheIndex = 1;
constexpr auto kMaskCacheIndex = 2;
@@ -84,10 +82,6 @@ Button::Button(
Button::~Button() = default;
ButtonStyle Button::style() const {
return _style;
}
bool Button::isHidden() const {
return (_state == State::Hidden) && !_scaleAnimation.animating();
}
@@ -160,12 +154,6 @@ void Button::applyParameters(
? State::Active
: State::Shown;
applyState(state, update);
if (_style != parameters.style) {
_style = parameters.style;
if (update) {
update(_geometry);
}
}
if (parameters.outside && _state == State::Shown) {
_hideTimer.callOnce(kButtonHideDelay);
} else {
@@ -281,24 +269,18 @@ Manager::Manager(
_inner.translate(QRect({}, _outer).center() - _inner.center());
const auto ratio = style::DevicePixelRatio();
_cacheInOutService = QImage(
_outer.width() * 3 * ratio,
_cacheBg = QImage(
_outer.width() * ratio,
_outer.height() * kFramesCount * ratio,
QImage::Format_ARGB32_Premultiplied);
_cacheInOutService.setDevicePixelRatio(ratio);
_cacheInOutService.fill(Qt::transparent);
_cacheBg.setDevicePixelRatio(ratio);
_cacheBg.fill(Qt::transparent);
_cacheParts = QImage(
_outer.width() * kCacheColumsCount * ratio,
_outer.height() * kFramesCount * ratio,
QImage::Format_ARGB32_Premultiplied);
_cacheParts.setDevicePixelRatio(ratio);
_cacheParts.fill(Qt::transparent);
_cacheForPattern = QImage(
QSize(
_outer.width(),
_outer.height() + st::reactionCornerAddedHeightMax) * ratio,
QImage::Format_ARGB32_Premultiplied);
_cacheForPattern.setDevicePixelRatio(ratio);
_shadowBuffer = QImage(
_outer * ratio,
QImage::Format_ARGB32_Premultiplied);
@@ -404,8 +386,7 @@ void Manager::applyList(std::vector<Data::Reaction> list) {
void Manager::setMainReactionImage(QImage image) {
_mainReactionImage = std::move(image);
ranges::fill(_validIn, false);
ranges::fill(_validOut, false);
ranges::fill(_validBg, false);
ranges::fill(_validEmoji, false);
loadOtherReactions();
}
@@ -576,38 +557,17 @@ void Manager::paintButton(
const auto geometry = button->geometry();
const auto position = geometry.topLeft();
const auto size = geometry.size();
const auto style = button->style();
const auto patterned = (style == ButtonStyle::Outgoing)
&& context.bubblesPattern
&& !context.viewport.isEmpty()
&& !context.bubblesPattern->pixmap.size().isEmpty();
const auto shadow = context.st->shadowFg()->c;
if (opacity != 1.) {
p.setOpacity(opacity);
}
if (patterned) {
const auto source = validateShadow(frameIndex, scale, shadow);
paintLongImage(p, geometry, _cacheParts, source);
validateCacheForPattern(frameIndex, scale, geometry, context);
p.drawImage(
geometry,
_cacheForPattern,
QRect(QPoint(), geometry.size() * style::DevicePixelRatio()));
} else {
const auto background = (style == ButtonStyle::Service)
? context.st->windowBg()->c
: context.st->messageStyle(
(style == ButtonStyle::Outgoing),
false
).msgBg->c;
const auto source = validateFrame(
style,
frameIndex,
scale,
background,
shadow);
paintLongImage(p, geometry, _cacheInOutService, source);
}
const auto background = context.st->windowBg()->c;
const auto source = validateFrame(
frameIndex,
scale,
background,
shadow);
paintLongImage(p, geometry, _cacheBg, source);
const auto mainEmojiPosition = position + (button->expandUp()
? QPoint(0, size.height() - _outer.height())
@@ -693,32 +653,12 @@ void Manager::paintAllEmoji(
}
}
void Manager::validateCacheForPattern(
int frameIndex,
float64 scale,
const QRect &geometry,
const PaintContext &context) {
auto q = QPainter(&_cacheForPattern);
q.setCompositionMode(QPainter::CompositionMode_Source);
const auto source = validateMask(frameIndex, scale);
paintLongImage(q, QRect(QPoint(), geometry.size()), _cacheParts, source);
q.setCompositionMode(QPainter::CompositionMode_SourceIn);
Ui::PaintPatternBubblePart(
q,
context.viewport.translated(-geometry.topLeft()),
context.bubblesPattern->pixmap,
QRect(QPoint(), geometry.size()));
}
void Manager::applyPatternedShadow(const QColor &shadow) {
if (_shadow == shadow) {
return;
}
_shadow = shadow;
ranges::fill(_validIn, false);
ranges::fill(_validOut, false);
ranges::fill(_validBg, false);
ranges::fill(_validShadow, false);
}
@@ -796,40 +736,24 @@ QRect Manager::validateEmoji(int frameIndex, float64 scale) {
}
QRect Manager::validateFrame(
ButtonStyle style,
int frameIndex,
float64 scale,
const QColor &background,
const QColor &shadow) {
applyPatternedShadow(shadow);
auto &valid = (style == ButtonStyle::Service)
? _validService
: (style == ButtonStyle::Outgoing)
? _validOut
: _validIn;
auto &color = (style == ButtonStyle::Service)
? _backgroundService
: (style == ButtonStyle::Outgoing)
? _backgroundOut
: _backgroundIn;
if (color != background) {
color = background;
ranges::fill(valid, false);
if (_background != background) {
_background = background;
ranges::fill(_validBg, false);
}
const auto columnIndex = (style == ButtonStyle::Service)
? kServiceCacheIndex
: (style == ButtonStyle::Outgoing)
? kOutCacheIndex
: kInCacheIndex;
const auto result = cacheRect(frameIndex, columnIndex);
if (valid[frameIndex]) {
const auto result = cacheRect(frameIndex, kBgCacheIndex);
if (_validBg[frameIndex]) {
return result;
}
const auto shadowSource = validateShadow(frameIndex, scale, shadow);
const auto position = result.topLeft() / style::DevicePixelRatio();
auto p = QPainter(&_cacheInOutService);
auto p = QPainter(&_cacheBg);
p.setCompositionMode(QPainter::CompositionMode_Source);
p.drawImage(position, _cacheParts, shadowSource);
p.setCompositionMode(QPainter::CompositionMode_SourceOver);
@@ -847,31 +771,7 @@ QRect Manager::validateFrame(
p.drawRoundedRect(inner, radius, radius);
p.restore();
p.end();
valid[frameIndex] = true;
return result;
}
QRect Manager::validateMask(int frameIndex, float64 scale) {
const auto result = cacheRect(frameIndex, kMaskCacheIndex);
if (_validMask[frameIndex]) {
return result;
}
auto p = QPainter(&_cacheParts);
auto hq = PainterHighQualityEnabler(p);
const auto position = result.topLeft() / style::DevicePixelRatio();
const auto inner = _inner.translated(position);
const auto radius = st::reactionCornerRadius;
const auto center = inner.center();
p.setPen(Qt::NoPen);
p.setBrush(Qt::white);
p.save();
p.translate(center);
p.scale(scale, scale);
p.translate(-center);
p.drawRoundedRect(inner, radius, radius);
_validMask[frameIndex] = true;
_validBg[frameIndex] = true;
return result;
}

View File

@@ -26,12 +26,6 @@ struct TextState;
namespace HistoryView::Reactions {
enum class ButtonStyle {
Incoming,
Outgoing,
Service,
};
enum class ExpandDirection {
Up,
Down,
@@ -49,7 +43,6 @@ struct ButtonParameters {
QPoint center;
QPoint pointer;
QPoint globalPointer;
ButtonStyle style = ButtonStyle::Incoming;
int reactionsCount = 1;
int visibleTop = 0;
int visibleBottom = 0;
@@ -76,7 +69,6 @@ public:
using State = ButtonState;
void applyState(State state);
[[nodiscard]] ButtonStyle style() const;
[[nodiscard]] bool expandUp() const;
[[nodiscard]] bool isHidden() const;
[[nodiscard]] QRect geometry() const;
@@ -107,7 +99,6 @@ private:
int _finalHeight = 0;
int _scroll = 0;
ExpandDirection _expandDirection = ExpandDirection::Up;
ButtonStyle _style = ButtonStyle::Incoming;
base::Timer _expandTimer;
base::Timer _hideTimer;
@@ -182,17 +173,10 @@ private:
const QColor &shadow);
QRect validateEmoji(int frameIndex, float64 scale);
QRect validateFrame(
ButtonStyle style,
int frameIndex,
float64 scale,
const QColor &background,
const QColor &shadow);
QRect validateMask(int frameIndex, float64 scale);
void validateCacheForPattern(
int frameIndex,
float64 scale,
const QRect &geometry,
const PaintContext &context);
[[nodiscard]] QMargins innerMargins() const;
[[nodiscard]] QRect buttonInner() const;
@@ -208,19 +192,13 @@ private:
mutable std::vector<ClickHandlerPtr> _links;
QSize _outer;
QRect _inner;
QImage _cacheInOutService;
QImage _cacheBg;
QImage _cacheParts;
QImage _cacheForPattern;
QImage _shadowBuffer;
std::array<bool, kFramesCount> _validIn = { { false } };
std::array<bool, kFramesCount> _validOut = { { false } };
std::array<bool, kFramesCount> _validService = { { false } };
std::array<bool, kFramesCount> _validBg = { { false } };
std::array<bool, kFramesCount> _validShadow = { { false } };
std::array<bool, kFramesCount> _validEmoji = { { false } };
std::array<bool, kFramesCount> _validMask = { { false } };
QColor _backgroundIn;
QColor _backgroundOut;
QColor _backgroundService;
QColor _background;
QColor _shadow;
std::shared_ptr<Data::DocumentMedia> _mainReactionMedia;

View File

@@ -127,7 +127,7 @@ QSize InlineList::countOptimalSize() {
const auto height = padding.top() + size + padding.bottom();
for (auto &button : _buttons) {
const auto width = widthBase + button.countTextWidth;
button.geometry = QRect(x, 0, width, height);
button.geometry.setSize({ width, height });
x += width + between;
}
return QSize(
@@ -136,13 +136,13 @@ QSize InlineList::countOptimalSize() {
}
QSize InlineList::countCurrentSize(int newWidth) {
if (newWidth >= maxWidth() || _buttons.empty()) {
if (_buttons.empty()) {
return optimalSize();
}
using Flag = InlineListData::Flag;
const auto between = st::reactionBottomBetween;
const auto left = (_data.flags & InlineListData::Flag::InBubble)
? st::reactionBottomInBubbleLeft
: 0;
const auto inBubble = (_data.flags & Flag::InBubble);
const auto left = inBubble ? st::reactionBottomInBubbleLeft : 0;
auto x = left;
auto y = 0;
for (auto &button : _buttons) {
@@ -161,6 +161,13 @@ QSize InlineList::countCurrentSize(int newWidth) {
return { newWidth, height + add };
}
void InlineList::flipToRight() {
for (auto &button : _buttons) {
button.geometry.moveLeft(
width() - button.geometry.x() - button.geometry.width());
}
}
int InlineList::placeAndResizeGetHeight(QRect available) {
const auto result = resizeGetHeight(available.width());
for (auto &button : _buttons) {

View File

@@ -49,6 +49,7 @@ public:
void update(Data &&data, int availableWidth);
QSize countCurrentSize(int newWidth) override;
[[nodiscard]] int placeAndResizeGetHeight(QRect available);
void flipToRight();
void updateSkipBlock(int width, int height);
void removeSkipBlock();

View File

@@ -360,9 +360,12 @@ void Gif::draw(Painter &p, const PaintContext &context) const {
auto via = separateRoundVideo ? item->Get<HistoryMessageVia>() : nullptr;
auto reply = separateRoundVideo ? _parent->displayedReply() : nullptr;
auto forwarded = separateRoundVideo ? item->Get<HistoryMessageForwarded>() : nullptr;
const auto rightAligned = separateRoundVideo
&& outbg
&& !_parent->delegate()->elementIsChatWide();
if (via || reply || forwarded) {
usew = maxWidth() - additionalWidth(via, reply, forwarded);
if (outbg) {
if (rightAligned) {
usex = width() - usew;
}
}
@@ -588,7 +591,7 @@ void Gif::draw(Painter &p, const PaintContext &context) const {
if (reply) {
recth += st::msgReplyBarSize.height();
}
int rectx = outbg ? 0 : (usew + st::msgReplyPadding.left());
int rectx = rightAligned ? 0 : (usew + st::msgReplyPadding.left());
int recty = painty;
if (rtl()) rectx = width() - rectx - rectw;
@@ -624,7 +627,7 @@ void Gif::draw(Painter &p, const PaintContext &context) const {
} else {
maxRight -= st::msgMargin.left();
}
if (isRound && !outbg) {
if (isRound && !rightAligned) {
auto infoWidth = _parent->infoWidth();
// This is just some arbitrary point,
@@ -766,9 +769,12 @@ TextState Gif::textState(QPoint point, StateRequest request) const {
auto via = separateRoundVideo ? item->Get<HistoryMessageVia>() : nullptr;
auto reply = separateRoundVideo ? _parent->displayedReply() : nullptr;
auto forwarded = separateRoundVideo ? item->Get<HistoryMessageForwarded>() : nullptr;
const auto rightAligned = separateRoundVideo
&& outbg
&& !_parent->delegate()->elementIsChatWide();
if (via || reply || forwarded) {
usew = maxWidth() - additionalWidth(via, reply, forwarded);
if (outbg) {
if (rightAligned) {
usex = width() - usew;
}
}
@@ -788,7 +794,7 @@ TextState Gif::textState(QPoint point, StateRequest request) const {
if (reply) {
recth += st::msgReplyBarSize.height();
}
auto rectx = outbg ? 0 : (usew + st::msgReplyPadding.left());
auto rectx = rightAligned ? 0 : (usew + st::msgReplyPadding.left());
auto recty = painty;
if (rtl()) rectx = width() - rectx - rectw;
@@ -857,7 +863,7 @@ TextState Gif::textState(QPoint point, StateRequest request) const {
} else {
maxRight -= st::msgMargin.left();
}
if (isRound && !outbg) {
if (isRound && !rightAligned) {
auto infoWidth = _parent->infoWidth();
// This is just some arbitrary point,
@@ -1177,13 +1183,15 @@ QRect Gif::contentRectForReactions() const {
auto paintx = 0, painty = 0, paintw = width(), painth = height();
auto usex = 0, usew = paintw;
const auto outbg = _parent->hasOutLayout();
const auto rightAligned = outbg
&& !_parent->delegate()->elementIsChatWide();
const auto item = _parent->data();
const auto via = item->Get<HistoryMessageVia>();
const auto reply = _parent->displayedReply();
const auto forwarded = item->Get<HistoryMessageForwarded>();
if (via || reply || forwarded) {
usew = maxWidth() - additionalWidth(via, reply, forwarded);
if (outbg) {
if (rightAligned) {
usex = width() - usew;
}
}
@@ -1204,7 +1212,10 @@ std::optional<int> Gif::reactionButtonCenterOverride() const {
maxRight -= st::msgMargin.left();
}
const auto infoWidth = _parent->infoWidth();
if (!_parent->hasOutLayout()) {
const auto outbg = _parent->hasOutLayout();
const auto rightAligned = outbg
&& !_parent->delegate()->elementIsChatWide();
if (!rightAligned) {
// This is just some arbitrary point,
// the main idea is to make info left aligned here.
fullRight += infoWidth - st::normalFont->height;

View File

@@ -112,7 +112,7 @@ void UnwrappedMedia::draw(Painter &p, const PaintContext &context) const {
if (width() < st::msgPadding.left() + st::msgPadding.right() + 1) {
return;
}
const auto rightAligned = _parent->hasOutLayout()
const auto rightAligned = context.outbg
&& !_parent->delegate()->elementIsChatWide();
const auto inWebPage = (_parent->media() != this);
const auto item = _parent->data();
@@ -183,7 +183,7 @@ void UnwrappedMedia::drawSurrounding(
const HistoryMessageForwarded *forwarded) const {
const auto st = context.st;
const auto sti = context.imageStyle();
const auto rightAligned = _parent->hasOutLayout()
const auto rightAligned = context.outbg
&& !_parent->delegate()->elementIsChatWide();
const auto rightActionSize = _parent->rightActionSize();
const auto fullRight = calculateFullRight(inner);

View File

@@ -4454,12 +4454,16 @@ bool OverlayWidget::handleContextMenu(std::optional<QPoint> position) {
const style::icon *icon) {
_menu->addAction(text, std::move(handler), icon);
});
_menu->setDestroyedCallback(crl::guard(_widget, [=] {
activateControls();
_receiveMouse = false;
InvokeQueued(_widget, [=] { receiveMouse(); });
}));
_menu->popup(QCursor::pos());
if (_menu->empty()) {
_menu = nullptr;
} else {
_menu->setDestroyedCallback(crl::guard(_widget, [=] {
activateControls();
_receiveMouse = false;
InvokeQueued(_widget, [=] { receiveMouse(); });
}));
_menu->popup(QCursor::pos());
}
activateControls();
return true;
}

View File

@@ -10,6 +10,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/platform/mac/base_utilities_mac.h"
#include "logs.h"
#include <QtCore/QMutex>
#include <Cocoa/Cocoa.h>
#include <CoreFoundation/CFURL.h>

View File

@@ -121,23 +121,40 @@ public:
private:
using Section = Dialogs::EntryState::Section;
[[nodiscard]] bool showInfo();
[[nodiscard]] bool showHidePromotion();
[[nodiscard]] bool showToggleArchived();
[[nodiscard]] bool showTogglePin();
void fillChatsListActions();
void fillHistoryActions();
void fillProfileActions();
void fillRepliesActions();
void fillScheduledActions();
void fillArchiveActions();
void addHidePromotion();
void addTogglePin();
void addToggleMute();
void addSupportInfo();
void addInfo();
//void addSearch();
//void addToFolder();
void addToggleUnreadMark();
void addToggleArchive();
void addUserActions(not_null<UserData*> user);
void addBlockUser(not_null<UserData*> user);
void addClearHistory();
void addDeleteChat();
void addLeaveChat();
void addManageChat();
void addCreatePoll();
void addThemeEdit();
void addBlockUser();
void addViewDiscussion();
void addExportChat();
void addReport();
void addNewContact();
void addShareContact();
void addEditContact();
void addBotToGroup();
void addNewMembers();
void addDeleteContact();
void addChatActions(not_null<ChatData*> chat);
void addChannelActions(not_null<ChannelData*> channel);
void addTogglesForArchive();
void addPollAction(not_null<PeerData*> peer);
not_null<SessionController*> _controller;
Dialogs::EntryState _request;
@@ -271,55 +288,13 @@ Filler::Filler(
, _addAction(addAction) {
}
bool Filler::showInfo() {
if (_request.section == Section::Profile
|| _peer->isSelf()
|| _peer->isRepliesChat()) {
return false;
} else if (_controller->activeChatCurrent().peer() != _peer) {
return true;
} else if (!_controller->adaptive().isThreeColumn()) {
return true;
} else if (!Core::App().settings().thirdSectionInfoEnabled()
&& !Core::App().settings().tabbedReplacedWithInfo()) {
return true;
}
return false;
}
bool Filler::showHidePromotion() {
if (_request.section != Section::ChatsList) {
return false;
}
const auto history = _peer->owner().historyLoaded(_peer);
return history
&& history->useTopPromotion()
&& !history->topPromotionType().isEmpty();
}
bool Filler::showToggleArchived() {
if (_request.section != Section::ChatsList) {
return false;
}
const auto history = _peer->owner().historyLoaded(_peer);
if (history && history->useTopPromotion()) {
return false;
} else if (!_peer->isNotificationsUser() && !_peer->isSelf()) {
return true;
}
return history && (history->folder() != nullptr);
}
bool Filler::showTogglePin() {
if (_request.section != Section::ChatsList) {
return false;
}
const auto history = _peer->owner().historyLoaded(_peer);
return history && !history->fixedOnTopIndex();
}
void Filler::addHidePromotion() {
const auto history = _peer->owner().history(_peer);
const auto history = _peer->owner().historyLoaded(_peer);
if (!history
|| !history->useTopPromotion()
|| history->topPromotionType().isEmpty()) {
return;
}
_addAction(tr::lng_context_hide_psa(tr::now), [=] {
history->cacheTopPromotion(false, QString(), QString());
history->session().api().request(MTPhelp_HidePromoData(
@@ -332,7 +307,10 @@ void Filler::addTogglePin() {
const auto controller = _controller;
const auto filterId = _request.filterId;
const auto peer = _peer;
const auto history = peer->owner().history(peer);
const auto history = peer->owner().historyLoaded(peer);
if (!history || history->fixedOnTopIndex()) {
return;
}
const auto pinText = [=] {
return history->isPinnedDialog(filterId)
? tr::lng_context_unpin_from_top(tr::now)
@@ -355,7 +333,36 @@ void Filler::addTogglePin() {
SetActionText(pinAction, std::move(actionText));
}
void Filler::addToggleMute() {
if (_peer->isSelf()) {
return;
}
PeerMenuAddMuteAction(_peer, _addAction);
}
void Filler::addSupportInfo() {
if (!_peer->session().supportMode()) {
return;
}
const auto user = _peer->asUser();
if (!user) {
return;
}
const auto controller = _controller;
_addAction("Edit support info", [=] {
user->session().supportHelper().editInfo(controller, user);
}, &st::menuIconEdit);
}
void Filler::addInfo() {
if (_peer->isSelf() || _peer->isRepliesChat()) {
return;
} else if (_controller->adaptive().isThreeColumn()) {
if (Core::App().settings().thirdSectionInfoEnabled()
|| Core::App().settings().tabbedReplacedWithInfo()) {
return;
}
}
const auto controller = _controller;
const auto peer = _peer;
const auto text = (peer->isChat() || peer->isMegagroup())
@@ -368,12 +375,7 @@ void Filler::addInfo() {
}, peer->isUser() ? &st::menuIconProfile : &st::menuIconInfo);
}
//void Filler::addSearch() {
// const auto controller = _controller;
// const auto peer = _peer;
// _addAction(tr::lng_profile_search_messages(tr::now), [=] {
// controller->content()->searchInChat(peer->owner().history(peer));
// }, &st::menuIconSearch);
//void Filler::addToFolder() {
//}
void Filler::addToggleUnreadMark() {
@@ -406,7 +408,14 @@ void Filler::addToggleUnreadMark() {
void Filler::addToggleArchive() {
const auto peer = _peer;
const auto history = peer->owner().history(peer);
const auto history = peer->owner().historyLoaded(peer);
if (history && history->useTopPromotion()) {
return;
} else if (peer->isNotificationsUser() || peer->isSelf()) {
if (!history || !history->folder()) {
return;
}
}
const auto isArchived = [=] {
return (history->folder() != nullptr);
};
@@ -430,7 +439,56 @@ void Filler::addToggleArchive() {
SetActionText(archiveAction, std::move(actionText));
}
void Filler::addBlockUser(not_null<UserData*> user) {
void Filler::addClearHistory() {
const auto channel = _peer->asChannel();
const auto isGroup = _peer->isChat() || _peer->isMegagroup();
if (channel) {
if (!channel->amIn()) {
return;
} else if (!channel->canDeleteMessages()
&& (!isGroup || channel->isPublic())) {
return;
}
}
_addAction(
tr::lng_profile_clear_history(tr::now),
ClearHistoryHandler(_peer),
&st::menuIconClear);
}
void Filler::addDeleteChat() {
if (_peer->isChannel()) {
return;
}
_addAction(
(_peer->isUser()
? tr::lng_profile_delete_conversation(tr::now)
: tr::lng_profile_clear_and_exit(tr::now)),
DeleteAndLeaveHandler(_peer),
&st::menuIconDelete);
}
void Filler::addLeaveChat() {
const auto channel = _peer->asChannel();
if (!channel || !channel->amIn()) {
return;
}
_addAction(
(_peer->isMegagroup()
? tr::lng_profile_leave_group(tr::now)
: tr::lng_profile_leave_channel(tr::now)),
DeleteAndLeaveHandler(_peer),
&st::menuIconLeave);
}
void Filler::addBlockUser() {
const auto user = _peer->asUser();
if (!user
|| user->isInaccessible()
|| user->isSelf()
|| user->isRepliesChat()) {
return;
}
const auto window = &_controller->window();
const auto blockText = [](not_null<UserData*> user) {
return user->isBlocked()
@@ -471,197 +529,153 @@ void Filler::addBlockUser(not_null<UserData*> user) {
}
}
void Filler::addUserActions(not_null<UserData*> user) {
const auto controller = _controller;
const auto window = &_controller->window();
if (_request.section != Section::ChatsList) {
if (user->session().supportMode()) {
_addAction("Edit support info", [=] {
user->session().supportHelper().editInfo(controller, user);
}, &st::menuIconEdit);
}
if (!user->isContact() && !user->isSelf() && !user->isBot()) {
_addAction(
tr::lng_info_add_as_contact(tr::now),
[=] { window->show(Box(EditContactBox, controller, user)); },
&st::menuIconInvite);
}
if (user->canShareThisContact()) {
_addAction(
tr::lng_info_share_contact(tr::now),
[=] { PeerMenuShareContactBox(controller, user); },
&st::menuIconShare);
}
if (user->isContact() && !user->isSelf()) {
_addAction(
tr::lng_info_edit_contact(tr::now),
[=] { window->show(Box(EditContactBox, controller, user)); },
&st::menuIconEdit);
_addAction(
tr::lng_info_delete_contact(tr::now),
[=] { PeerMenuDeleteContact(user); },
&st::menuIconRemove);
}
if (user->isBot()
&& !user->isRepliesChat()
&& !user->botInfo->cantJoinGroups) {
using AddBotToGroup = AddBotToGroupBoxController;
_addAction(
tr::lng_profile_invite_to_group(tr::now),
[=] { AddBotToGroup::Start(user); },
&st::menuIconInvite);
}
addPollAction(user);
if (!user->isBot() && _request.section == Section::History) {
_addAction(
tr::lng_chat_theme_change(tr::now),
[=] { controller->toggleChooseChatTheme(user); },
&st::menuIconChangeColors);
}
if (user->canExportChatHistory()) {
_addAction(
tr::lng_profile_export_chat(tr::now),
[=] { PeerMenuExportChat(user); },
&st::menuIconExport);
}
}
_addAction(
tr::lng_profile_delete_conversation(tr::now),
DeleteAndLeaveHandler(user),
&st::menuIconDelete);
_addAction(
tr::lng_profile_clear_history(tr::now),
ClearHistoryHandler(user),
&st::menuIconClear);
if (!user->isInaccessible()
&& user != user->session().user()
&& !user->isRepliesChat()
&& _request.section != Section::ChatsList) {
addBlockUser(user);
}
}
void Filler::addChatActions(not_null<ChatData*> chat) {
const auto navigation = _controller;
if (_request.section != Section::ChatsList) {
if (EditPeerInfoBox::Available(chat)) {
const auto text = tr::lng_manage_group_title(tr::now);
_addAction(text, [=] {
navigation->showEditPeerBox(chat);
}, &st::menuIconManage);
}
if (chat->canAddMembers()) {
_addAction(
tr::lng_channel_add_members(tr::now),
[=] { AddChatMembers(navigation, chat); },
&st::menuIconInvite);
}
addPollAction(chat);
if (chat->canExportChatHistory()) {
_addAction(
tr::lng_profile_export_chat(tr::now),
[=] { PeerMenuExportChat(chat); },
&st::menuIconExport);
}
}
_addAction(
tr::lng_profile_clear_and_exit(tr::now),
DeleteAndLeaveHandler(_peer),
&st::menuIconDelete);
_addAction(
tr::lng_profile_clear_history(tr::now),
ClearHistoryHandler(_peer),
&st::menuIconClear);
if (_request.section != Section::ChatsList) {
if (!chat->amCreator()) {
_addAction(tr::lng_profile_report(tr::now), [=] {
HistoryView::ShowReportPeerBox(navigation, chat);
}, &st::menuIconReport);
}
}
}
void Filler::addChannelActions(not_null<ChannelData*> channel) {
const auto isGroup = channel->isMegagroup();
const auto navigation = _controller;
if (_request.section != Section::ChatsList) {
if (channel->isBroadcast()) {
if (const auto chat = channel->linkedChat()) {
_addAction(tr::lng_profile_view_discussion(tr::now), [=] {
if (channel->invitePeekExpires()) {
Ui::Toast::Show(
tr::lng_channel_invite_private(tr::now));
return;
}
navigation->showPeerHistory(
chat,
Window::SectionShow::Way::Forward);
}, &st::menuIconDiscussion);
}
}
if (EditPeerInfoBox::Available(channel)) {
const auto text = isGroup
? tr::lng_manage_group_title(tr::now)
: tr::lng_manage_channel_title(tr::now);
_addAction(text, [=] {
navigation->showEditPeerBox(channel);
}, &st::menuIconManage);
}
if (channel->canAddMembers()) {
_addAction(
(channel->isMegagroup()
? tr::lng_channel_add_members(tr::now)
: tr::lng_channel_add_users(tr::now)),
[=] { PeerMenuAddChannelMembers(navigation, channel); },
&st::menuIconInvite);
}
addPollAction(channel);
if (channel->canExportChatHistory()) {
_addAction(
(isGroup
? tr::lng_profile_export_chat(tr::now)
: tr::lng_profile_export_channel(tr::now)),
[=] { PeerMenuExportChat(channel); },
&st::menuIconExport);
}
}
if (channel->amIn()) {
auto text = isGroup
? tr::lng_profile_leave_group(tr::now)
: tr::lng_profile_leave_channel(tr::now);
_addAction(
text,
DeleteAndLeaveHandler(channel),
&st::menuIconLeave);
if ((isGroup && !channel->isPublic())
|| channel->canDeleteMessages()) {
_addAction(
tr::lng_profile_clear_history(tr::now),
ClearHistoryHandler(channel),
&st::menuIconClear);
}
} else {
auto text = isGroup
? tr::lng_profile_join_group(tr::now)
: tr::lng_profile_join_channel(tr::now);
_addAction(
text,
[=] { channel->session().api().joinChannel(channel); },
&st::menuIconInvite); // #TODO icons
}
if (_request.section != Section::ChatsList) {
if (!channel->amCreator()) {
_addAction(tr::lng_profile_report(tr::now), [=] {
HistoryView::ShowReportPeerBox(navigation, channel);
}, &st::menuIconReport);
}
}
}
void Filler::addPollAction(not_null<PeerData*> peer) {
if (!peer->canSendPolls()) {
void Filler::addViewDiscussion() {
const auto channel = _peer->asBroadcast();
if (!channel) {
return;
}
const auto chat = channel->linkedChat();
if (!chat) {
return;
}
const auto navigation = _controller;
_addAction(tr::lng_profile_view_discussion(tr::now), [=] {
if (channel->invitePeekExpires()) {
Ui::Toast::Show(
tr::lng_channel_invite_private(tr::now));
return;
}
navigation->showPeerHistory(
chat,
Window::SectionShow::Way::Forward);
}, &st::menuIconDiscussion);
}
void Filler::addExportChat() {
if (!_peer->canExportChatHistory()) {
return;
}
const auto peer = _peer;
_addAction(
tr::lng_profile_export_chat(tr::now),
[=] { PeerMenuExportChat(peer); },
&st::menuIconExport);
}
void Filler::addReport() {
const auto chat = _peer->asChat();
const auto channel = _peer->asChannel();
if ((!chat || chat->amCreator())
&& (!channel || channel->amCreator())) {
return;
}
const auto peer = _peer;
const auto navigation = _controller;
_addAction(tr::lng_profile_report(tr::now), [=] {
HistoryView::ShowReportPeerBox(navigation, peer);
}, &st::menuIconReport);
}
void Filler::addNewContact() {
const auto user = _peer->asUser();
if (!user || user->isContact() || user->isSelf() || user->isBot()) {
return;
}
const auto controller = _controller;
_addAction(
tr::lng_info_add_as_contact(tr::now),
[=] { controller->show(Box(EditContactBox, controller, user)); },
&st::menuIconInvite);
}
void Filler::addShareContact() {
const auto user = _peer->asUser();
if (!user || !user->canShareThisContact()) {
return;
}
const auto controller = _controller;
_addAction(
tr::lng_info_share_contact(tr::now),
[=] { PeerMenuShareContactBox(controller, user); },
&st::menuIconShare);
}
void Filler::addEditContact() {
const auto user = _peer->asUser();
if (!user || !user->isContact() || user->isSelf()) {
return;
}
const auto controller = _controller;
_addAction(
tr::lng_info_edit_contact(tr::now),
[=] { controller->show(Box(EditContactBox, controller, user)); },
&st::menuIconEdit);
}
void Filler::addBotToGroup() {
const auto user = _peer->asUser();
if (!user
|| !user->isBot()
|| user->isRepliesChat()
|| user->botInfo->cantJoinGroups) {
return;
}
using AddBotToGroup = AddBotToGroupBoxController;
_addAction(
tr::lng_profile_invite_to_group(tr::now),
[=] { AddBotToGroup::Start(user); },
&st::menuIconInvite);
}
void Filler::addNewMembers() {
const auto chat = _peer->asChat();
const auto channel = _peer->asChannel();
if ((!chat || !chat->canAddMembers())
&& (!channel || !channel->canAddMembers())) {
return;
}
const auto navigation = _controller;
const auto callback = chat
? Fn<void()>([=] { AddChatMembers(navigation, chat); })
: [=] { PeerMenuAddChannelMembers(navigation, channel); };
_addAction(
((chat || channel->isMegagroup())
? tr::lng_channel_add_members(tr::now)
: tr::lng_channel_add_users(tr::now)),
callback,
&st::menuIconInvite);
}
void Filler::addDeleteContact() {
const auto user = _peer->asUser();
if (!user || !user->isContact() || user->isSelf()) {
return;
}
_addAction(
tr::lng_info_delete_contact(tr::now),
[=] { PeerMenuDeleteContact(user); },
&st::menuIconDelete);
}
void Filler::addManageChat() {
if (!EditPeerInfoBox::Available(_peer)) {
return;
}
const auto peer = _peer;
const auto navigation = _controller;
const auto text = (peer->isChat() || peer->isMegagroup())
? tr::lng_manage_group_title(tr::now)
: tr::lng_manage_channel_title(tr::now);
_addAction(text, [=] {
navigation->showEditPeerBox(peer);
}, &st::menuIconManage);
}
void Filler::addCreatePoll() {
if (!_peer->canSendPolls()) {
return;
}
const auto peer = _peer;
const auto controller = _controller;
const auto source = (_request.section == Section::Scheduled)
? Api::SendType::Scheduled
@@ -691,45 +705,90 @@ void Filler::addPollAction(not_null<PeerData*> peer) {
&st::menuIconCreatePoll);
}
void Filler::addThemeEdit() {
const auto user = _peer->asUser();
if (!user || user->isBot()) {
return;
}
const auto controller = _controller;
_addAction(
tr::lng_chat_theme_change(tr::now),
[=] { controller->toggleChooseChatTheme(user); },
&st::menuIconChangeColors);
}
void Filler::fill() {
if (_folder) {
addTogglesForArchive();
return;
} else if (_request.section == Section::Scheduled
|| _request.section == Section::Replies) {
addPollAction(_peer);
fillArchiveActions();
return;
}
if (showHidePromotion()) {
addHidePromotion();
}
if (showToggleArchived()) {
addToggleArchive();
}
if (showTogglePin()) {
addTogglePin();
}
if (showInfo()) {
addInfo();
}
if (_request.section != Section::Profile && !_peer->isSelf()) {
PeerMenuAddMuteAction(_peer, _addAction);
}
if (_request.section == Section::ChatsList) {
//addSearch();
addToggleUnreadMark();
}
if (const auto user = _peer->asUser()) {
addUserActions(user);
} else if (const auto chat = _peer->asChat()) {
addChatActions(chat);
} else if (const auto channel = _peer->asChannel()) {
addChannelActions(channel);
switch (_request.section) {
case Section::ChatsList: fillChatsListActions(); break;
case Section::History: fillHistoryActions(); break;
case Section::Profile: fillProfileActions(); break;
case Section::Replies: fillRepliesActions(); break;
case Section::Scheduled: fillScheduledActions(); break;
default: Unexpected("_request.section in Filler::fill.");
}
}
void Filler::addTogglesForArchive() {
void Filler::fillChatsListActions() {
addHidePromotion();
addToggleArchive();
addTogglePin();
addToggleMute();
addToggleUnreadMark();
// addToFolder();
if (const auto user = _peer->asUser()) {
if (!user->isContact()) {
addBlockUser();
}
}
addClearHistory();
addDeleteChat();
addLeaveChat();
}
void Filler::fillHistoryActions() {
addInfo();
addToggleMute();
addSupportInfo();
addManageChat();
addCreatePoll();
addThemeEdit();
addViewDiscussion();
addExportChat();
addReport();
addClearHistory();
addDeleteChat();
addLeaveChat();
}
void Filler::fillProfileActions() {
addSupportInfo();
addNewContact();
addShareContact();
addEditContact();
addBotToGroup();
addNewMembers();
addManageChat();
addViewDiscussion();
addExportChat();
addBlockUser();
addReport();
addLeaveChat();
addDeleteContact();
}
void Filler::fillRepliesActions() {
addCreatePoll();
}
void Filler::fillScheduledActions() {
addCreatePoll();
}
void Filler::fillArchiveActions() {
Expects(_folder != nullptr);
if (_folder->id() != Data::Folder::kId) {
@@ -1244,8 +1303,8 @@ void PeerMenuAddMuteAction(
peer->owner().requestNotifySettings(peer);
const auto muteText = [](bool isUnmuted) {
return isUnmuted
? tr::lng_disable_notifications_from_tray(tr::now)
: tr::lng_enable_notifications_from_tray(tr::now);
? tr::lng_context_mute(tr::now)
: tr::lng_context_unmute(tr::now);
};
const auto muteAction = addAction(QString("-"), [=] {
if (!peer->owner().notifyIsMuted(peer)) {

View File

@@ -4,6 +4,7 @@ ARG QT6=true
FROM centos:7 AS builder
ENV GIT https://github.com
ENV GIT_FREEDESKTOP ${GIT}/gitlab-freedesktop-mirrors
ENV PKG_CONFIG_PATH /usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig
ENV QT5_VER 5_15_2
ENV QT5_TAG v5.15.2
@@ -176,7 +177,7 @@ WORKDIR ..
RUN rm -rf rnnoise
FROM builder AS xcb-proto
RUN git clone -b xcb-proto-1.14.1 --depth=1 https://gitlab.freedesktop.org/xorg/proto/xcbproto.git
RUN git clone -b xcb-proto-1.14.1 --depth=1 $GIT_FREEDESKTOP/xcbproto.git
WORKDIR xcbproto
RUN ./autogen.sh
@@ -189,7 +190,7 @@ RUN rm -rf xcbproto
FROM builder AS xcb
COPY --from=xcb-proto ${LibrariesPath}/xcb-proto-cache /
RUN git clone -b libxcb-1.14 --depth=1 https://gitlab.freedesktop.org/xorg/lib/libxcb.git
RUN git clone -b libxcb-1.14 --depth=1 $GIT_FREEDESKTOP/libxcb.git
WORKDIR libxcb
RUN CFLAGS="-g -O2 $HFLAGS" ./autogen.sh --enable-static
@@ -201,7 +202,7 @@ RUN rm -rf libxcb
FROM builder AS xcb-wm
RUN git clone -b 0.4.1 --depth=1 --recursive https://gitlab.freedesktop.org/xorg/lib/libxcb-wm.git
RUN git clone -b 0.4.1 --depth=1 --recursive $GIT_FREEDESKTOP/libxcb-wm.git
WORKDIR libxcb-wm
RUN ./autogen.sh --enable-static
@@ -210,7 +211,7 @@ RUN make DESTDIR="$LibrariesPath/xcb-wm-cache" install
FROM builder AS xcb-util
RUN git clone -b 0.4.0 --depth=1 --recursive https://gitlab.freedesktop.org/xorg/lib/libxcb-util.git
RUN git clone -b 0.4.0 --depth=1 --recursive $GIT_FREEDESKTOP/libxcb-util.git
WORKDIR libxcb-util
RUN ./autogen.sh --enable-static
@@ -220,7 +221,7 @@ RUN make DESTDIR="$LibrariesPath/xcb-util-cache" install
FROM builder AS xcb-image
COPY --from=xcb-util ${LibrariesPath}/xcb-util-cache /
RUN git clone -b 0.4.0 --depth=1 --recursive https://gitlab.freedesktop.org/xorg/lib/libxcb-image.git
RUN git clone -b 0.4.0 --depth=1 --recursive $GIT_FREEDESKTOP/libxcb-image.git
WORKDIR libxcb-image
RUN CFLAGS="-g -O2 $HFLAGS" ./autogen.sh --enable-static
@@ -229,7 +230,7 @@ RUN make DESTDIR="$LibrariesPath/xcb-image-cache" install
FROM builder AS xcb-keysyms
RUN git clone -b 0.4.0 --depth=1 --recursive https://gitlab.freedesktop.org/xorg/lib/libxcb-keysyms.git
RUN git clone -b 0.4.0 --depth=1 --recursive $GIT_FREEDESKTOP/libxcb-keysyms.git
WORKDIR libxcb-keysyms
RUN CFLAGS="-g -O2 $HFLAGS" ./autogen.sh --enable-static
@@ -238,7 +239,7 @@ RUN make DESTDIR="$LibrariesPath/xcb-keysyms-cache" install
FROM builder AS xcb-render-util
RUN git clone -b 0.3.9 --depth=1 --recursive https://gitlab.freedesktop.org/xorg/lib/libxcb-render-util.git
RUN git clone -b 0.3.9 --depth=1 --recursive $GIT_FREEDESKTOP/libxcb-render-util.git
WORKDIR libxcb-render-util
RUN CFLAGS="-g -O2 $HFLAGS" ./autogen.sh --enable-static
@@ -246,7 +247,7 @@ RUN make -j$(nproc)
RUN make DESTDIR="$LibrariesPath/xcb-render-util-cache" install
FROM builder AS libXext
RUN git clone -b libXext-1.3.4 --depth=1 https://gitlab.freedesktop.org/xorg/lib/libxext.git
RUN git clone -b libXext-1.3.4 --depth=1 $GIT_FREEDESKTOP/libxext.git
WORKDIR libxext
RUN CFLAGS="-g -O2 $HFLAGS" ./autogen.sh --enable-static
@@ -257,7 +258,7 @@ WORKDIR ..
RUN rm -rf libxext
FROM builder AS libXtst
RUN git clone -b libXtst-1.2.3 --depth=1 https://gitlab.freedesktop.org/xorg/lib/libxtst.git
RUN git clone -b libXtst-1.2.3 --depth=1 $GIT_FREEDESKTOP/libxtst.git
WORKDIR libxtst
RUN CFLAGS="-g -O2 $HFLAGS" ./autogen.sh --enable-static
@@ -268,7 +269,7 @@ WORKDIR ..
RUN rm -rf libxtst
FROM builder AS libXfixes
RUN git clone -b libXfixes-5.0.3 --depth=1 https://gitlab.freedesktop.org/xorg/lib/libxfixes.git
RUN git clone -b libXfixes-5.0.3 --depth=1 $GIT_FREEDESKTOP/libxfixes.git
WORKDIR libxfixes
RUN CFLAGS="-g -O2 $HFLAGS" ./autogen.sh --enable-static
@@ -281,7 +282,7 @@ RUN rm -rf libxfixes
FROM builder AS libXv
COPY --from=libXext ${LibrariesPath}/libXext-cache /
RUN git clone -b libXv-1.0.11 --depth=1 https://gitlab.freedesktop.org/xorg/lib/libxv.git
RUN git clone -b libXv-1.0.11 --depth=1 $GIT_FREEDESKTOP/libxv.git
WORKDIR libxv
RUN ./autogen.sh --enable-static
@@ -292,7 +293,7 @@ WORKDIR ..
RUN rm -rf libxv
FROM builder AS libXrandr
RUN git clone -b libXrandr-1.5.2 --depth=1 https://gitlab.freedesktop.org/xorg/lib/libxrandr.git
RUN git clone -b libXrandr-1.5.2 --depth=1 $GIT_FREEDESKTOP/libxrandr.git
WORKDIR libxrandr
RUN CFLAGS="-g -O2 $HFLAGS" ./autogen.sh --enable-static
@@ -303,7 +304,7 @@ WORKDIR ..
RUN rm -rf libxrandr
FROM builder AS libXrender
RUN git clone -b libXrender-0.9.10 --depth=1 https://gitlab.freedesktop.org/xorg/lib/libxrender.git
RUN git clone -b libXrender-0.9.10 --depth=1 $GIT_FREEDESKTOP/libxrender.git
WORKDIR libxrender
RUN CFLAGS="-g -O2 $HFLAGS" ./autogen.sh --enable-static
@@ -314,7 +315,7 @@ WORKDIR ..
RUN rm -rf libxrender
FROM builder AS libXdamage
RUN git clone -b libXdamage-1.1.5 --depth=1 https://gitlab.freedesktop.org/xorg/lib/libxdamage.git
RUN git clone -b libXdamage-1.1.5 --depth=1 $GIT_FREEDESKTOP/libxdamage.git
WORKDIR libxdamage
RUN CFLAGS="-g -O2 $HFLAGS" ./autogen.sh --enable-static
@@ -325,7 +326,7 @@ WORKDIR ..
RUN rm -rf libxdamage
FROM builder AS libXcomposite
RUN git clone -b libXcomposite-0.4.5 --depth=1 https://gitlab.freedesktop.org/xorg/lib/libxcomposite.git
RUN git clone -b libXcomposite-0.4.5 --depth=1 $GIT_FREEDESKTOP/libxcomposite.git
WORKDIR libxcomposite
RUN CFLAGS="-g -O2 $HFLAGS" ./autogen.sh --enable-static
@@ -338,7 +339,7 @@ RUN rm -rf libxcomposite
FROM builder AS wayland
COPY --from=libffi ${LibrariesPath}/libffi-cache /
RUN git clone -b 1.20.0 --depth=1 https://gitlab.freedesktop.org/wayland/wayland.git
RUN git clone -b 1.20.0 --depth=1 $GIT_FREEDESKTOP/wayland.git
WORKDIR wayland
RUN meson build \
@@ -358,7 +359,7 @@ RUN rm -rf wayland
FROM builder AS wayland-protocols
COPY --from=wayland ${LibrariesPath}/wayland-cache /
RUN git clone -b 1.24 --depth=1 https://gitlab.freedesktop.org/wayland/wayland-protocols.git
RUN git clone -b 1.24 --depth=1 $GIT_FREEDESKTOP/wayland-protocols.git
WORKDIR wayland-protocols
RUN meson build \
@@ -386,7 +387,7 @@ WORKDIR ..
RUN rm -rf plasma-wayland-protocols
FROM builder AS libpciaccess
RUN git clone -b libpciaccess-0.16 --depth=1 https://gitlab.freedesktop.org/xorg/lib/libpciaccess.git
RUN git clone -b libpciaccess-0.16 --depth=1 $GIT_FREEDESKTOP/libpciaccess.git
WORKDIR libpciaccess
RUN ./autogen.sh --enable-static
@@ -400,7 +401,7 @@ RUN rm -rf libpciaccess
FROM builder AS drm
COPY --from=libpciaccess ${LibrariesPath}/libpciaccess-cache /
RUN git clone -b libdrm-2.4.109 --depth=1 https://gitlab.freedesktop.org/mesa/drm.git
RUN git clone -b libdrm-2.4.109 --depth=1 $GIT_FREEDESKTOP/drm.git
WORKDIR drm
RUN meson build \
@@ -436,7 +437,7 @@ WORKDIR ..
RUN rm -rf libva
FROM builder AS libvdpau
RUN git clone -b 1.4 --depth=1 https://gitlab.freedesktop.org/vdpau/libvdpau.git
RUN git clone -b 1.4 --depth=1 $GIT_FREEDESKTOP/libvdpau.git
WORKDIR libvdpau
RUN sed -i 's/shared_library/library/g' src/meson.build

View File

@@ -1,7 +1,7 @@
AppVersion 3004002
AppVersion 3004003
AppVersionStrMajor 3.4
AppVersionStrSmall 3.4.2
AppVersionStr 3.4.2
AppVersionStrSmall 3.4.3
AppVersionStr 3.4.3
BetaChannel 0
AlphaVersion 0
AppVersionOriginal 3.4.2
AppVersionOriginal 3.4.3

View File

@@ -1,3 +1,7 @@
3.4.3 (03.01.21)
- Bug fixes and other minor improvements.
3.4.2 (31.12.21)
- Bug fixes and other minor improvements.