Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a new pull request by comparing changes across two branches #744

Merged
merged 11 commits into from
Oct 8, 2024
5 changes: 5 additions & 0 deletions Telegram/Resources/langs/lang.strings
Original file line number Diff line number Diff line change
Expand Up @@ -2486,6 +2486,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_credits_small_balance_about" = "Buy **Stars** and use them on **{bot}** and other miniapps.";
"lng_credits_small_balance_reaction" = "Buy **Stars** and send them to {channel} to support their posts.";
"lng_credits_small_balance_subscribe" = "Buy **Stars** and subscribe to **{channel}** and other channels.";
"lng_credits_small_balance_star_gift" = "Buy **Stars** to send gifts to {user} and other contacts.";
"lng_credits_small_balance_fallback" = "Buy **Stars** to unlock content and services on Telegram.";
"lng_credits_purchase_blocked" = "Sorry, you can't purchase this item with Telegram Stars.";
"lng_credits_enough" = "You have enough stars at the moment. {link}";
Expand Down Expand Up @@ -3014,6 +3015,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_gift_stars_about" = "Give {name} gifts that can be kept on your profile or converted to Stars. {link}";
"lng_gift_stars_link" = "What are Stars >";
"lng_gift_stars_limited" = "limited";
"lng_gift_stars_sold_out" = "sold out";
"lng_gift_stars_tabs_all" = "All Gifts";
"lng_gift_stars_tabs_limited" = "Limited";
"lng_gift_send_title" = "Send a Gift";
Expand Down Expand Up @@ -3047,6 +3049,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_gift_display_done_hide" = "The gift is now hidden from your profile page.";
"lng_gift_got_stars#one" = "You got **{count} Star** for this gift.";
"lng_gift_got_stars#other" = "You got **{count} Stars** for this gift.";
"lng_gift_sold_out_title" = "Sold Out!";
"lng_gift_sold_out_text#one" = "All {count} gift was already sold.";
"lng_gift_sold_out_text#other" = "All {count} gifts were already sold.";

"lng_accounts_limit_title" = "Limit Reached";
"lng_accounts_limit1#one" = "You have reached the limit of **{count}** connected account.";
Expand Down
2 changes: 1 addition & 1 deletion Telegram/Resources/uwp/AppX/AppxManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Identity Name="TelegramMessengerLLP.TelegramDesktop"
ProcessorArchitecture="ARCHITECTURE"
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
Version="5.6.0.0" />
Version="5.6.1.0" />
<Properties>
<DisplayName>Telegram Desktop</DisplayName>
<PublisherDisplayName>Telegram Messenger LLP</PublisherDisplayName>
Expand Down
8 changes: 4 additions & 4 deletions Telegram/Resources/winrc/Telegram.rc
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 5,6,0,0
PRODUCTVERSION 5,6,0,0
FILEVERSION 5,6,1,0
PRODUCTVERSION 5,6,1,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -62,10 +62,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "Telegram FZ-LLC"
VALUE "FileDescription", "Telegram Desktop"
VALUE "FileVersion", "5.6.0.0"
VALUE "FileVersion", "5.6.1.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2024"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "5.6.0.0"
VALUE "ProductVersion", "5.6.1.0"
END
END
BLOCK "VarFileInfo"
Expand Down
8 changes: 4 additions & 4 deletions Telegram/Resources/winrc/Updater.rc
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 5,6,0,0
PRODUCTVERSION 5,6,0,0
FILEVERSION 5,6,1,0
PRODUCTVERSION 5,6,1,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -53,10 +53,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "Telegram FZ-LLC"
VALUE "FileDescription", "Telegram Desktop Updater"
VALUE "FileVersion", "5.6.0.0"
VALUE "FileVersion", "5.6.1.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2024"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "5.6.0.0"
VALUE "ProductVersion", "5.6.1.0"
END
END
BLOCK "VarFileInfo"
Expand Down
11 changes: 11 additions & 0 deletions Telegram/SourceFiles/boxes/star_gift_box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ void PreviewWrap::paintEvent(QPaintEvent *e) {
.convertStars = gift.convertStars,
.document = gift.document,
.limitedCount = gift.limitedCount,
.limitedLeft = gift.limitedLeft,
});
}
auto &map = Map[session];
Expand Down Expand Up @@ -1081,6 +1082,7 @@ void SendGiftBox(
}
};
button->setClickedCallback([=] {
const auto star = std::get_if<GiftTypeStars>(&descriptor);
if (v::is<GiftTypePremium>(descriptor)) {
if (state->sending) {
return;
Expand All @@ -1093,6 +1095,15 @@ void SendGiftBox(
api,
GiftDetails{ descriptor },
premiumSent);
} else if (star && star->limitedCount && !star->limitedLeft) {
window->showToast({
.title = tr::lng_gift_sold_out_title(tr::now),
.text = tr::lng_gift_sold_out_text(
tr::now,
lt_count_decimal,
star->limitedCount,
Ui::Text::RichLangValue),
});
} else {
window->show(
Box(SendGiftBox, window, peer, api, descriptor));
Expand Down
1 change: 1 addition & 0 deletions Telegram/SourceFiles/calls/calls.style
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,7 @@ groupCallTitle: WindowTitle(defaultWindowTitle) {
bgActive: groupCallBg;
fg: transparent;
fgActive: transparent;
oneSideControls: true;
minimize: IconButton(groupCallTitleButton) {
icon: groupCallTitleMinimizeIcon;
iconOver: groupCallTitleMinimizeIconOver;
Expand Down
4 changes: 3 additions & 1 deletion Telegram/SourceFiles/calls/calls_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ void Panel::initWindow() {
return Flag::None | Flag(0);
}
#ifndef Q_OS_MAC
if (_controls->controls.geometry().contains(widgetPoint)) {
using Result = Ui::Platform::HitTestResult;
const auto windowPoint = widget()->mapTo(window(), widgetPoint);
if (_controls->controls.hitTest(windowPoint) != Result::None) {
return Flag::None | Flag(0);
}
#endif // !Q_OS_MAC
Expand Down
4 changes: 2 additions & 2 deletions Telegram/SourceFiles/core/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 = 5006000;
constexpr auto AppVersionStr = "5.6";
constexpr auto AppVersion = 5006001;
constexpr auto AppVersionStr = "5.6.1";
constexpr auto AppBetaVersion = false;
constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION;
7 changes: 7 additions & 0 deletions Telegram/SourceFiles/dialogs/dialogs.style
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,11 @@ dialogsUpdateButton: FlatButton {
}
dialogsInstallUpdate: icon {{ "install_update", activeButtonFg }};
dialogsInstallUpdateOver: icon {{ "install_update", activeButtonFgOver }};
dialogsInstallUpdateIconSkip: 7px;
dialogsInstallUpdateIconSize: 20px;
dialogsInstallUpdateIconInnerMargin: 5px;
dialogsInstallUpdateIconSide1: 5px;
dialogsInstallUpdateIconSide2: 3px;

dialogsLoadMoreButton: FlatButton(dialogsUpdateButton) {
color: lightButtonFg;
Expand All @@ -442,6 +447,8 @@ dialogsLoadMoreButton: FlatButton(dialogsUpdateButton) {

height: 36px;
textTop: 9px;
font: semiboldFont;
overFont: semiboldFont;
}
dialogsLoadMore: icon {{ "install_update-flip_vertical", lightButtonFg }};
dialogsLoadMoreLoading: InfiniteRadialAnimation(defaultInfiniteRadialAnimation) {
Expand Down
135 changes: 123 additions & 12 deletions Telegram/SourceFiles/dialogs/dialogs_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ For license and copyright information please follow this link:
#include "ui/controls/download_bar.h"
#include "ui/controls/jump_down_button.h"
#include "ui/painter.h"
#include "ui/rect.h"
#include "ui/ui_utility.h"
#include "lang/lang_keys.h"
#include "mainwindow.h"
Expand Down Expand Up @@ -113,6 +114,56 @@ base::options::toggle OptionForumHideChatsList({
return false;
}

[[nodiscard]] QImage UpdateIcon() {
const auto iconSize = st::dialogsInstallUpdateIconSize;
auto result = QImage(
Size(iconSize) * style::DevicePixelRatio(),
QImage::Format_ARGB32_Premultiplied);
result.fill(Qt::transparent);
{
auto p = QPainter(&result);
auto hq = PainterHighQualityEnabler(p);
auto path = QPainterPath();

const auto fullRect = QRectF(0, 0, iconSize, iconSize);
const auto rect = fullRect
- Margins(st::dialogsInstallUpdateIconInnerMargin);
p.setPen(Qt::NoPen);
p.setBrush(Qt::white);
p.drawEllipse(fullRect);

p.setCompositionMode(QPainter::CompositionMode_Clear);

auto pen = QPen(Qt::black);
pen.setWidthF(style::ConvertFloatScale(2.));
pen.setCapStyle(Qt::RoundCap);
p.setPen(pen);

using namespace arc;
constexpr auto kShift = int(20 * 16);
p.drawArc(rect, -kShift, kQuarterLength + kShift);
p.drawArc(rect, kHalfLength - kShift, kQuarterLength + kShift);

const auto side1 = st::dialogsInstallUpdateIconSide1;
const auto side2 = st::dialogsInstallUpdateIconSide2;
const auto top = rect.y() - side1;
const auto bottom = rect::bottom(rect) - side1;
const auto centerX = rect::center(rect).x();
path.moveTo(centerX, bottom + side1 + side2);
path.lineTo(centerX, bottom + side1 - side2);
path.lineTo(centerX + side2, bottom + side1);
path.closeSubpath();

path.moveTo(centerX, top + side1 + side2);
path.lineTo(centerX, top + side1 - side2);
path.lineTo(centerX - side2, top + side1);
path.closeSubpath();

p.fillPath(path, Qt::black);
}
return result;
}

} // namespace

const char kOptionForumHideChatsList[] = "forum-hide-chats-list";
Expand All @@ -124,7 +175,8 @@ class Widget::BottomButton : public Ui::RippleButton {
const QString &text,
const style::FlatButton &st,
const style::icon &icon,
const style::icon &iconOver);
const style::icon &iconOver,
bool hasTextIcon);

void setText(const QString &text);

Expand All @@ -140,22 +192,35 @@ class Widget::BottomButton : public Ui::RippleButton {
const style::FlatButton &_st;
const style::icon &_icon;
const style::icon &_iconOver;
const bool _hasTextIcon;
std::unique_ptr<Ui::InfiniteRadialAnimation> _loading;

QImage _textIcon;

};

Widget::BottomButton::BottomButton(
QWidget *parent,
const QString &text,
const style::FlatButton &st,
const style::icon &icon,
const style::icon &iconOver)
const style::icon &iconOver,
bool hasTextIcon)
: RippleButton(parent, st.ripple)
, _text(text)
, _st(st)
, _icon(icon)
, _iconOver(iconOver) {
, _iconOver(iconOver)
, _hasTextIcon(hasTextIcon) {
resize(st::columnMinimalWidthLeft, _st.height);

if (_hasTextIcon) {
rpl::single(rpl::empty_value()) | rpl::then(
style::PaletteChanged()
) | rpl::start_with_next([this] {
_textIcon = UpdateIcon();
}, lifetime());
}
}

void Widget::BottomButton::setText(const QString &text) {
Expand Down Expand Up @@ -189,20 +254,56 @@ void Widget::BottomButton::paintEvent(QPaintEvent *e) {

const auto over = isOver() && !isDisabled();

QRect r(0, height() - _st.height, width(), _st.height);
p.fillRect(r, over ? _st.overBgColor : _st.bgColor);
auto r = QRect(0, height() - _st.height, width(), _st.height);

if (_hasTextIcon) {
auto gradient = QLinearGradient(0, 0, width(), 0);
gradient.setStops({
{ 0., st::groupCallLive1->c },
{ 1., st::groupCallLive2->c },
});
p.fillRect(r, QBrush(std::move(gradient)));
if (over) {
p.fillRect(
r,
anim::with_alpha(st::universalRippleAnimation.color->c, .3));
}

if (!isDisabled()) {
paintRipple(p, 0, 0);
if (!isDisabled()) {
paintRipple(p, 0, 0, &st::universalRippleAnimation.color->c);
}
} else {
p.fillRect(r, over ? _st.overBgColor : _st.bgColor);
if (!isDisabled()) {
paintRipple(p, 0, 0);
}
}

p.setFont(over ? _st.overFont : _st.font);
const auto &font = over ? _st.overFont : _st.font;
p.setFont(font);
p.setRenderHint(QPainter::TextAntialiasing);
p.setPen(over ? _st.overColor : _st.color);

if (width() >= st::columnMinimalWidthLeft) {
r.setTop(_st.textTop);
p.drawText(r, _text, style::al_top);
if (_hasTextIcon) {
const auto &icon = _textIcon;
const auto iconSize = icon.size() / style::DevicePixelRatio();
const auto skip = st::dialogsInstallUpdateIconSkip;
const auto textWidth = font->width(_text);
const auto rect = QRect(
(width() - (iconSize.width() + textWidth + skip)) / 2,
r.y(),
textWidth,
r.height());
p.drawText(
rect.translated(iconSize.width() + skip, 0),
_text,
style::al_top);
p.drawImage(rect.x(), (height() - iconSize.height()) / 2, icon);
} else {
p.drawText(r, _text, style::al_top);
}
} else if (isDisabled() && _loading) {
_loading->draw(
p,
Expand All @@ -211,7 +312,15 @@ void Widget::BottomButton::paintEvent(QPaintEvent *e) {
(height() - st::dialogsLoadMoreLoading.size.height()) / 2),
width());
} else {
(over ? _iconOver : _icon).paintInCenter(p, r);
if (_hasTextIcon) {
const auto size = _textIcon.size() / style::DevicePixelRatio();
p.drawImage(
(width() - size.width()) / 2,
(height() - size.height()) / 2,
_textIcon);
} else {
(over ? _iconOver : _icon).paintInCenter(p, r);
}
}
}

Expand Down Expand Up @@ -1594,7 +1703,8 @@ void Widget::checkUpdateStatus() {
tr::lng_update_telegram(tr::now),
st::dialogsUpdateButton,
st::dialogsInstallUpdate,
st::dialogsInstallUpdateOver);
st::dialogsInstallUpdateOver,
true);
_updateTelegram->show();
_updateTelegram->setClickedCallback([] {
Core::checkReadyUpdate();
Expand Down Expand Up @@ -1962,7 +2072,8 @@ void Widget::refreshLoadMoreButton(bool mayBlock, bool isBlocked) {
"Load more",
st::dialogsLoadMoreButton,
st::dialogsLoadMore,
st::dialogsLoadMore);
st::dialogsLoadMore,
false);
_loadMoreChats->show();
_loadMoreChats->addClickHandler([=] {
loadMoreBlockedByDate();
Expand Down
3 changes: 2 additions & 1 deletion Telegram/SourceFiles/history/history_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6251,7 +6251,8 @@ void HistoryWidget::updateHistoryGeometry(
if (!initial) {
visibleAreaUpdated();
}

}
if (needResize || initial) {
if (_autocomplete) {
_autocomplete->setBoundings(_scroll->geometry());
}
Expand Down
Loading
Loading