diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 8fc2c693d..1c7b47a9c 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -1666,8 +1666,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_group_stickers_description" = "You can choose a sticker set which will be available for every member while in the group chat."; "lng_group_stickers_add" = "Choose sticker set"; "lng_premium_stickers" = "Premium stickers"; -"lng_premium_reaction_no_group" = "This reaction is not available in this group."; -"lng_premium_reaction_no_channel" = "This reaction is not available in this channel."; "lng_premium" = "Premium"; "lng_premium_free" = "Free"; diff --git a/Telegram/SourceFiles/boxes/premium_limits_box.cpp b/Telegram/SourceFiles/boxes/premium_limits_box.cpp index 4e7c03b4e..2aa08afb0 100644 --- a/Telegram/SourceFiles/boxes/premium_limits_box.cpp +++ b/Telegram/SourceFiles/boxes/premium_limits_box.cpp @@ -876,7 +876,6 @@ void FileSizeLimitBox( not_null box, not_null session, uint64 fileSizeBytes) { - const auto premium = session->premium(); const auto premiumPossible = session->premiumPossible(); const auto defaultLimit = Limit( diff --git a/Telegram/SourceFiles/boxes/premium_preview_box.cpp b/Telegram/SourceFiles/boxes/premium_preview_box.cpp index 8d17725a6..b3f763493 100644 --- a/Telegram/SourceFiles/boxes/premium_preview_box.cpp +++ b/Telegram/SourceFiles/boxes/premium_preview_box.cpp @@ -74,10 +74,6 @@ bool operator==(const Descriptor &a, const Descriptor &b) { && (a.fromSettings == b.fromSettings); } -bool operator!=(const Descriptor &a, const Descriptor &b) { - return !(a == b); -} - [[nodiscard]] int ComputeX(int column, int columns) { const auto skip = st::premiumReactionWidthSkip; const auto fullWidth = columns * skip; @@ -375,7 +371,8 @@ void PreloadSticker(const std::shared_ptr &media) { state->toggleTimer.callOnce(kToggleStickerTimeout); } }; - state->index = (++state->index) % state->medias.size(); + ++state->index; + state->index %= state->medias.size(); delete std::exchange(state->previous, state->current); state->current = state->next; createNext(); @@ -764,16 +761,6 @@ private: }; -[[nodiscard]] QString DisabledText(ReactionDisableType type) { - switch (type) { - case ReactionDisableType::Group: - return tr::lng_premium_reaction_no_group(tr::now); - case ReactionDisableType::Channel: - return tr::lng_premium_reaction_no_channel(tr::now); - } - return QString(); -} - ReactionPreview::ReactionPreview( not_null controller, const Data::Reaction &reaction, @@ -868,7 +855,6 @@ bool ReactionPreview::disabled() const { } void ReactionPreview::paint(Painter &p) { - const auto size = st::premiumReactionAround; const auto center = st::premiumReactionSize; const auto scale = _scale.value(_over ? 1. : st::premiumReactionScale); const auto inner = QRect( @@ -1518,14 +1504,6 @@ void Show(not_null controller, QImage back) { } } -[[nodiscard]] QImage SolidColorImage(QSize size, QColor color) { - const auto ratio = style::DevicePixelRatio(); - auto result = QImage(size * ratio, QImage::Format_ARGB32_Premultiplied); - result.setDevicePixelRatio(ratio); - result.fill(color); - return result; -} - void Show( not_null controller, Descriptor &&descriptor) { @@ -1569,22 +1547,8 @@ void Show( const auto fill = QSize(st::boxWideWidth, st::boxWideWidth); const auto stops = Ui::Premium::LimitGradientStops(); - //const auto theme = controller->currentChatTheme(); - //const auto color = theme->background().colorForFill; - //const auto area = QSize(fill.width(), fill.height() * 2); - //const auto request = theme->cacheBackgroundRequest(area); crl::async([=] { - using Option = Images::Option; - //auto back = color - // ? SolidColorImage(area, *color) - // : request.background.waitingForNegativePattern() - // ? SolidColorImage(area, Qt::black) - // : Ui::CacheBackground(request).image; const auto factor = style::DevicePixelRatio(); - //auto cropped = back.copy(QRect( - // QPoint(0, fill.height() * factor / 2), - // fill * factor)); - //cropped.setDevicePixelRatio(factor); auto cropped = QImage( fill * factor, QImage::Format_ARGB32_Premultiplied); @@ -1595,10 +1559,6 @@ void Show( p.fillRect(QRect(QPoint(), fill), gradient); p.end(); - const auto options = Images::Options() - | Option::RoundSkipBottomLeft - | Option::RoundSkipBottomRight - | Option::RoundLarge; const auto result = Images::Round( std::move(cropped), Images::CornersMask(st::boxRadius), diff --git a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp index 53a1e835b..1c5c437c8 100644 --- a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp +++ b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp @@ -320,7 +320,6 @@ void AddPostLinkAction( && !request.link->copyToClipboardContextItemText().isEmpty()) { return; } - const auto session = &item->history()->session(); const auto itemId = item->fullId(); const auto context = request.view ? request.view->context() diff --git a/Telegram/SourceFiles/history/view/history_view_emoji_interactions.cpp b/Telegram/SourceFiles/history/view/history_view_emoji_interactions.cpp index db3884c82..2964582fe 100644 --- a/Telegram/SourceFiles/history/view/history_view_emoji_interactions.cpp +++ b/Telegram/SourceFiles/history/view/history_view_emoji_interactions.cpp @@ -231,7 +231,6 @@ void EmojiInteractions::visibleAreaUpdated( QRect EmojiInteractions::computeRect(const Play &play) const { const auto view = play.view; - const auto fullWidth = view->width(); const auto sticker = play.inner; const auto size = play.outer; const auto shift = play.premium diff --git a/Telegram/SourceFiles/history/view/media/history_view_document.cpp b/Telegram/SourceFiles/history/view/media/history_view_document.cpp index 547b7cada..493a40a0d 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_document.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_document.cpp @@ -104,7 +104,6 @@ void PaintWaveform( wfSize); const auto barNormValue = (wf ? voiceData->wavemax : 0) + 1; const auto maxDelta = st::msgWaveformMax - st::msgWaveformMin; - const auto &bottom = st::msgWaveformMax; p.setPen(Qt::NoPen); auto hq = PainterHighQualityEnabler(p); for (auto i = 0, barLeft = 0, sum = 0, maxValue = 0; i < wfSize; ++i) { diff --git a/Telegram/SourceFiles/info/profile/info_profile_cover.cpp b/Telegram/SourceFiles/info/profile/info_profile_cover.cpp index b8d278811..c04f21fac 100644 --- a/Telegram/SourceFiles/info/profile/info_profile_cover.cpp +++ b/Telegram/SourceFiles/info/profile/info_profile_cover.cpp @@ -37,100 +37,6 @@ namespace Info { namespace Profile { namespace { -class SectionToggle : public Ui::AbstractCheckView { -public: - SectionToggle( - const style::InfoToggle &st, - bool checked, - Fn updateCallback); - - QSize getSize() const override; - void paint( - Painter &p, - int left, - int top, - int outerWidth) override; - QImage prepareRippleMask() const override; - bool checkRippleStartPosition(QPoint position) const override; - -private: - QSize rippleSize() const; - - const style::InfoToggle &_st; - -}; - -SectionToggle::SectionToggle( - const style::InfoToggle &st, - bool checked, - Fn updateCallback) -: AbstractCheckView(st.duration, checked, std::move(updateCallback)) -, _st(st) { -} - -QSize SectionToggle::getSize() const { - return QSize(_st.size, _st.size); -} - -void SectionToggle::paint( - Painter &p, - int left, - int top, - int outerWidth) { - auto sqrt2 = sqrt(2.); - auto vLeft = style::rtlpoint(left + _st.skip, 0, outerWidth).x() + 0.; - auto vTop = top + _st.skip + 0.; - auto vWidth = _st.size - 2 * _st.skip; - auto vHeight = _st.size - 2 * _st.skip; - auto vStroke = _st.stroke / sqrt2; - constexpr auto kPointCount = 6; - std::array pathV = { { - { vLeft, vTop + (vHeight / 4.) + vStroke }, - { vLeft + vStroke, vTop + (vHeight / 4.) }, - { vLeft + (vWidth / 2.), vTop + (vHeight * 3. / 4.) - vStroke }, - { vLeft + vWidth - vStroke, vTop + (vHeight / 4.) }, - { vLeft + vWidth, vTop + (vHeight / 4.) + vStroke }, - { vLeft + (vWidth / 2.), vTop + (vHeight * 3. / 4.) + vStroke }, - } }; - - auto toggled = currentAnimationValue(); - auto alpha = (toggled - 1.) * M_PI_2; - auto cosalpha = cos(alpha); - auto sinalpha = sin(alpha); - auto shiftx = vLeft + (vWidth / 2.); - auto shifty = vTop + (vHeight / 2.); - for (auto &point : pathV) { - auto x = point.x() - shiftx; - auto y = point.y() - shifty; - point.setX(shiftx + x * cosalpha - y * sinalpha); - point.setY(shifty + y * cosalpha + x * sinalpha); - } - QPainterPath path; - path.moveTo(pathV[0]); - for (int i = 1; i != kPointCount; ++i) { - path.lineTo(pathV[i]); - } - path.lineTo(pathV[0]); - - PainterHighQualityEnabler hq(p); - p.fillPath(path, _st.color); -} - -QImage SectionToggle::prepareRippleMask() const { - return Ui::RippleAnimation::ellipseMask(rippleSize()); -} - -QSize SectionToggle::rippleSize() const { - return getSize() + 2 * QSize( - _st.rippleAreaPadding, - _st.rippleAreaPadding); -} - -bool SectionToggle::checkRippleStartPosition(QPoint position) const { - return QRect(QPoint(0, 0), rippleSize()).contains(position); - -} - auto MembersStatusText(int count) { return tr::lng_chat_status_members(tr::now, lt_count_decimal, count); }; diff --git a/Telegram/SourceFiles/media/streaming/media_streaming_reader.cpp b/Telegram/SourceFiles/media/streaming/media_streaming_reader.cpp index fe6acddd7..44c163f08 100644 --- a/Telegram/SourceFiles/media/streaming/media_streaming_reader.cpp +++ b/Telegram/SourceFiles/media/streaming/media_streaming_reader.cpp @@ -550,7 +550,7 @@ void Reader::Slices::processPart( auto Reader::Slices::fill(uint32 offset, bytes::span buffer) -> FillResult { Expects(!buffer.empty()); - Expects(offset >= 0 && offset < _size); + Expects(offset < _size); Expects(offset + buffer.size() <= _size); Expects(buffer.size() <= kInSlice); @@ -569,8 +569,7 @@ auto Reader::Slices::fill(uint32 offset, bytes::span buffer) -> FillResult { const auto till = uint32(offset + buffer.size()); const auto fromSlice = offset / kInSlice; const auto tillSlice = (till + kInSlice - 1) / kInSlice; - Assert(fromSlice >= 0 - && (fromSlice + 1 == tillSlice || fromSlice + 2 == tillSlice) + Assert((fromSlice + 1 == tillSlice || fromSlice + 2 == tillSlice) && tillSlice <= _data.size()); const auto cacheNotLoaded = [&](int sliceIndex) { diff --git a/Telegram/SourceFiles/ui/effects/premium_graphics.cpp b/Telegram/SourceFiles/ui/effects/premium_graphics.cpp index 448966a90..f590ba877 100644 --- a/Telegram/SourceFiles/ui/effects/premium_graphics.cpp +++ b/Telegram/SourceFiles/ui/effects/premium_graphics.cpp @@ -266,8 +266,6 @@ public: rpl::producer<> showFinishes, const style::icon *icon); - [[nodiscard]] bool animating() const; - protected: void paintEvent(QPaintEvent *e) override; @@ -390,10 +388,6 @@ BubbleWidget::BubbleWidget( }, lifetime()); } -bool BubbleWidget::animating() const { - return _appearanceAnimation.animating(); -} - void BubbleWidget::paintEvent(QPaintEvent *e) { if (_bubble.counter() <= 0) { return; @@ -832,13 +826,13 @@ void ShowListBox( const auto content = box->verticalLayout(); for (auto &entry : entries) { - const auto subtitle = content->add( + content->add( object_ptr( content, base::take(entry.subtitle) | rpl::map(Ui::Text::Bold), stLabel), titlePadding); - const auto description = content->add( + content->add( object_ptr( content, base::take(entry.description), diff --git a/Telegram/lib_waylandshells b/Telegram/lib_waylandshells index 2878b2a8a..866d3618c 160000 --- a/Telegram/lib_waylandshells +++ b/Telegram/lib_waylandshells @@ -1 +1 @@ -Subproject commit 2878b2a8a32a64e73c4a4ebf56b552e8ec6e87ed +Subproject commit 866d3618cf2518530589fccd60157138f611bbcd