Compare commits

..

27 Commits

Author SHA1 Message Date
John Preston
1350fa64f3 Version 4.2.4.
- Fix crash in emoji statuses clearing.
2022-09-30 16:30:58 +04:00
John Preston
70ba28bbd5 Fix crash in emoji statuses clearing. 2022-09-30 16:30:58 +04:00
Ilya Fedin
16649a9661 Fix snap build 2022-09-30 07:44:18 +04:00
Ilya Fedin
8eb6d2e36b Update Qt and libjxl to release versions on Linux 2022-09-30 00:24:32 +04:00
23rd
8b580de47e Version 4.2.3: Fixed Github CI Windows and macOS builds. 2022-09-29 21:22:06 +04:00
23rd
5b1a9fb3e1 Migrated gyp for breakpad to upstream in prepare script on macOS. 2022-09-29 21:22:06 +04:00
Ilya Fedin
2a6e2fa353 Bundle kcoreaddons 2022-09-28 23:59:59 +04:00
Ilya Fedin
16669402cf Decrease the amount of clipboard data retrievation 2022-09-28 23:59:59 +04:00
John Preston
073c1a4d0f Version 4.2.3: Fix possible crash in premium section. 2022-09-28 15:58:25 +04:00
John Preston
4c276e2357 Version 4.2.3: Fix clearing of user emoji status. 2022-09-28 15:49:34 +04:00
John Preston
889529718f Fix possible stack overflow crash on Windows.
Fixes #25129.
2022-09-28 15:49:34 +04:00
23rd
acb092f9f2 Fixed stuck of history-down button after sending message. 2022-09-28 12:31:16 +03:00
23rd
9cd194e60e Removed ability to copy links in channels with restricted content. 2022-09-28 12:31:16 +03:00
23rd
9c3173e4bb Fixed updating of emoji status from TopBar in Premium Settings for user.
Regression was introduced in 47b32898f5.
2022-09-28 08:46:35 +03:00
John Preston
62b624c390 Version 4.2.3.
- Improve scaling / cropping for photos / video files.
- Improve touch support in channel comments.
- Nice animation for spoilers.
2022-09-28 09:34:31 +04:00
John Preston
1ee9122660 Fix text selection in recent actions. 2022-09-25 18:22:01 +04:00
John Preston
6cb01998cc Fix crash in recent actions with spoilers. 2022-09-25 18:21:59 +04:00
John Preston
0e6c899cee Fix crash after spoiler reveal in comments. 2022-09-25 18:21:58 +04:00
John Preston
09a6df1fdc Set some layers crash annotations. 2022-09-25 18:21:56 +04:00
John Preston
43bdfbf170 Beta version 4.2.2.
- Fix crash in spoiler revealing in media captions.
- Fix spoiler revealing in media viewer captions.
- Fix crash in folder editing on Linux.
2022-09-23 23:50:37 +04:00
John Preston
bcfe4ac4a3 Allow revealing spoilers in media viewer captions. 2022-09-23 23:50:21 +04:00
John Preston
c67c53bcdf Fix build with GCC. 2022-09-23 23:32:54 +04:00
John Preston
330c6a31a2 Fix crash in empty text state resolving. 2022-09-23 23:32:22 +04:00
John Preston
aa674a0ea5 Fix UB in closing chat across all windows. 2022-09-23 23:32:21 +04:00
John Preston
e01910ac68 Fix a crash in folders editing, happens in Qt 6.4.
Fixes #25074.
2022-09-23 23:32:19 +04:00
John Preston
eac13b31f1 Fix crash in subscribe button. 2022-09-23 23:32:18 +04:00
John Preston
d4a2c4a151 Fix crash in caption spoiler opening. 2022-09-23 23:22:08 +04:00
43 changed files with 267 additions and 247 deletions

View File

@@ -40,7 +40,7 @@ jobs:
macos:
name: MacOS
runs-on: macos-latest
runs-on: macos-12
strategy:
matrix:

View File

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

3
.gitmodules vendored
View File

@@ -94,3 +94,6 @@
[submodule "Telegram/ThirdParty/kimageformats"]
path = Telegram/ThirdParty/kimageformats
url = https://github.com/KDE/kimageformats.git
[submodule "Telegram/ThirdParty/kcoreaddons"]
path = Telegram/ThirdParty/kcoreaddons
url = https://github.com/KDE/kcoreaddons.git

View File

@@ -10,7 +10,7 @@
<Identity Name="TelegramMessengerLLP.TelegramDesktop"
ProcessorArchitecture="ARCHITECTURE"
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
Version="4.2.1.0" />
Version="4.2.4.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,1,0
PRODUCTVERSION 4,2,1,0
FILEVERSION 4,2,4,0
PRODUCTVERSION 4,2,4,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.1.0"
VALUE "FileVersion", "4.2.4.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2022"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "4.2.1.0"
VALUE "ProductVersion", "4.2.4.0"
END
END
BLOCK "VarFileInfo"

View File

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

View File

@@ -805,13 +805,13 @@ void SendFilesBox::captionResized() {
}
bool SendFilesBox::canAddFiles(not_null<const QMimeData*> data) const {
return (data->hasUrls() && CanAddUrls(base::GetMimeUrls(data))) || data->hasImage();
return CanAddUrls(base::GetMimeUrls(data)) || data->hasImage();
}
bool SendFilesBox::addFiles(not_null<const QMimeData*> data) {
const auto premium = _controller->session().premium();
auto list = [&] {
const auto urls = data->hasUrls() ? base::GetMimeUrls(data) : QList<QUrl>();
const auto urls = base::GetMimeUrls(data);
auto result = CanAddUrls(urls)
? Storage::PrepareMediaList(
urls,

View File

@@ -1205,11 +1205,9 @@ void Application::closeWindow(not_null<Window::Controller*> window) {
void Application::closeChatFromWindows(not_null<PeerData*> peer) {
for (const auto &[history, window] : _secondaryWindows) {
if (!window) {
continue;
}
if (history->peer == peer) {
closeWindow(window.get());
break;
} else if (const auto session = window->sessionController()) {
if (session->activeChatCurrent().peer() == peer) {
session->showPeerHistory(

View File

@@ -33,6 +33,12 @@ void BaseIntegration::logMessage(const QString &message) {
Logs::writeMain(message);
}
void BaseIntegration::setCrashAnnotation(
const std::string &key,
const QString &value) {
CrashReports::SetAnnotation(key, value);
}
void BaseIntegration::logAssertionViolation(const QString &info) {
Logs::writeMain("Assertion Failed! " + info);
CrashReports::SetAnnotation("Assertion", info);

View File

@@ -20,6 +20,9 @@ public:
void logMessageDebug(const QString &message) override;
void logMessage(const QString &message) override;
void logAssertionViolation(const QString &info) override;
void setCrashAnnotation(
const std::string &key,
const QString &value) override;
};

View File

@@ -68,6 +68,14 @@ std::map<int, const char*> BetaLogs() {
"- Improve touch support in channel comments.\n"
"- Nice animation for spoilers.\n"
},
{
4002002,
"- Fix crash in spoiler revealing in media captions.\n"
"- Fix spoiler revealing in media viewer captions.\n"
"- Fix crash in folder editing on Linux.\n"
}
};
};

View File

@@ -31,7 +31,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QtCore/QJsonDocument>
#include <QtCore/QJsonObject>
#include <KSandbox>
#include <ksandbox.h>
extern "C" {
#include <openssl/rsa.h>

View File

@@ -22,12 +22,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <cmath>
#include <set>
#if __has_include(<KUrlMimeData>)
#include <KUrlMimeData>
#if __has_include(<kurlmimedata.h>)
#include <kurlmimedata.h>
#endif
#if __has_include(<KSandbox>)
#include <KSandbox>
#if __has_include(<ksandbox.h>)
#include <ksandbox.h>
#endif
#define qsl(s) QStringLiteral(s)
@@ -39,17 +39,19 @@ inline bool in_range(Value &&value, From &&from, Till &&till) {
return (value >= from) && (value < till);
}
inline auto GetMimeUrls(const QMimeData *data) {
#if __has_include(<KUrlMimeData>)
#if __has_include(<kurlmimedata.h>)
inline QList<QUrl> GetMimeUrls(const QMimeData *data) {
if (!data->hasUrls()) {
return {};
}
return KUrlMimeData::urlsFromMimeData(
data,
KUrlMimeData::PreferLocalUrls);
#else
return data->urls();
#endif
}
#endif
#if __has_include(<KSandbox>) && defined DeclareReadSetting
#if __has_include(<ksandbox.h>) && defined DeclareReadSetting
inline QString FlatpakID() {
static const auto Result = [] {
if (!qEnvironmentVariableIsEmpty("FLATPAK_ID")) {

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 = 4002001;
constexpr auto AppVersionStr = "4.2.1";
constexpr auto AppBetaVersion = true;
constexpr auto AppVersion = 4002004;
constexpr auto AppVersionStr = "4.2.4";
constexpr auto AppBetaVersion = false;
constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION;

View File

@@ -44,7 +44,8 @@ constexpr auto kMaxTimeout = 6 * 60 * 60 * crl::time(1000);
EmojiStatuses::EmojiStatuses(not_null<Session*> owner)
: _owner(owner)
, _defaultRefreshTimer([=] { refreshDefault(); }) {
, _defaultRefreshTimer([=] { refreshDefault(); })
, _clearingTimer([=] { processClearing(); }) {
refreshDefault();
refreshColored();
@@ -118,8 +119,7 @@ void EmojiStatuses::registerAutomaticClear(
if (i->first == user) {
const auto now = base::unixtime::now();
if (now < until) {
const auto waitms = (until - now) * crl::time(1000);
_clearingTimer.callOnce(std::min(waitms, kMaxTimeout));
processClearingIn(until - now);
} else {
processClearing();
}
@@ -152,12 +152,17 @@ void EmojiStatuses::processClearing() {
}
}
if (minWait) {
_clearingTimer.callOnce(minWait * crl::time(1000));
processClearingIn(minWait);
} else {
_clearingTimer.cancel();
}
}
void EmojiStatuses::processClearingIn(TimeId wait) {
const auto waitms = wait * crl::time(1000);
_clearingTimer.callOnce(std::min(waitms, kMaxTimeout));
}
void EmojiStatuses::requestRecent() {
if (_recentRequestId) {
return;

View File

@@ -62,6 +62,7 @@ private:
void updateDefault(const MTPDaccount_emojiStatuses &data);
void updateColored(const MTPDmessages_stickerSet &data);
void processClearingIn(TimeId wait);
void processClearing();
const not_null<Session*> _owner;
@@ -85,7 +86,7 @@ private:
mtpRequestId _sentRequestId = 0;
base::flat_map<not_null<UserData*>, crl::time> _clearing;
base::flat_map<not_null<UserData*>, TimeId> _clearing;
base::Timer _clearingTimer;
rpl::lifetime _lifetime;

View File

@@ -1572,7 +1572,6 @@ rpl::producer<not_null<const HistoryItem*>> Session::itemRemoved(
}
void Session::notifyViewRemoved(not_null<const ViewElement*> view) {
_shownSpoilers.remove(view);
_viewRemoved.fire_copy(view);
}
@@ -3707,6 +3706,8 @@ void Session::registerItemView(not_null<ViewElement*> view) {
void Session::unregisterItemView(not_null<ViewElement*> view) {
Expects(!_heavyViewParts.contains(view));
_shownSpoilers.remove(view);
const auto i = _views.find(view->data());
if (i != end(_views)) {
auto &list = i->second;

View File

@@ -2364,7 +2364,7 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
}
}
}
if (!actionText.isEmpty()) {
if (!actionText.isEmpty() && !hasCopyRestriction(item)) {
_menu->addAction(
actionText,
[text = link->copyToClipboardText()] {

View File

@@ -3770,6 +3770,10 @@ void HistoryWidget::send(Api::SendOptions options) {
return;
}
if (!options.scheduled) {
clearReplyReturns();
}
const auto webPageId = (_previewState != Data::PreviewState::Allowed)
? CancelledWebPageId
: ((_previewData && _previewData->pendingTill >= 0)

View File

@@ -1001,7 +1001,9 @@ base::unique_qptr<Ui::PopupMenu> FillContextMenu(
}
}
AddCopyLinkAction(result, link);
if (!list->hasCopyRestriction(view->data())) {
AddCopyLinkAction(result, link);
}
AddMessageActions(result, request, list);
if (item) {

View File

@@ -1606,7 +1606,8 @@ TextState Message::textState(
result = entry->textState(
point - QPoint(entryLeft, entryTop),
request);
result.symbol += text().length() + (mediaDisplayed ? media->fullSelectionLength() : 0);
result.symbol += visibleTextLength()
+ visibleMediaTextLength();
}
}
@@ -1624,7 +1625,7 @@ TextState Message::textState(
result = bottomInfoResult;
}
};
if (inBubble) {
if (!result.symbol && inBubble) {
if (mediaDisplayed) {
auto mediaHeight = media->height();
auto mediaLeft = trect.x() - st::msgPadding.left();
@@ -1632,18 +1633,18 @@ TextState Message::textState(
if (point.y() >= mediaTop && point.y() < mediaTop + mediaHeight) {
result = media->textState(point - QPoint(mediaLeft, mediaTop), request);
result.symbol += text().length();
result.symbol += visibleTextLength();
} else if (getStateText(point, trect, &result, request)) {
checkBottomInfoState();
return result;
} else if (point.y() >= trect.y() + trect.height()) {
result.symbol = text().length();
result.symbol = visibleTextLength();
}
} else if (getStateText(point, trect, &result, request)) {
checkBottomInfoState();
return result;
} else if (point.y() >= trect.y() + trect.height()) {
result.symbol = text().length();
result.symbol = visibleTextLength();
}
}
checkBottomInfoState();
@@ -1665,7 +1666,7 @@ TextState Message::textState(
}
} else if (media && media->isDisplayed()) {
result = media->textState(point - g.topLeft(), request);
result.symbol += text().length();
result.symbol += visibleTextLength();
}
if (keyboard && item->isHistoryEntry()) {
@@ -2002,7 +2003,9 @@ void Message::updatePressed(QPoint point) {
TextForMimeData Message::selectedText(TextSelection selection) const {
const auto media = this->media();
auto logEntryOriginalResult = TextForMimeData();
auto textResult = text().toTextForMimeData(selection);
auto textResult = hasVisibleText()
? text().toTextForMimeData(selection)
: TextForMimeData();
auto skipped = skipTextSelection(selection);
auto mediaDisplayed = (media && media->isDisplayed());
auto mediaResult = (mediaDisplayed || isHiddenByGroup())
@@ -2033,8 +2036,10 @@ TextSelection Message::adjustSelection(
TextSelectType type) const {
const auto media = this->media();
auto result = text().adjustSelection(selection, type);
auto beforeMediaLength = text().length();
auto result = hasVisibleText()
? text().adjustSelection(selection, type)
: selection;
auto beforeMediaLength = visibleTextLength();
if (selection.to <= beforeMediaLength) {
return result;
}
@@ -2048,8 +2053,7 @@ TextSelection Message::adjustSelection(
result.to = mediaSelection.to;
}
}
auto beforeEntryLength = beforeMediaLength
+ (mediaDisplayed ? media->fullSelectionLength() : 0);
auto beforeEntryLength = beforeMediaLength + visibleMediaTextLength();
if (selection.to <= beforeEntryLength) {
return result;
}
@@ -2887,13 +2891,16 @@ void Message::fromNameUpdated(int width) const {
}
TextSelection Message::skipTextSelection(TextSelection selection) const {
if (selection.from == 0xFFFF) {
if (selection.from == 0xFFFF || !hasVisibleText()) {
return selection;
}
return HistoryView::UnshiftItemSelection(selection, text());
}
TextSelection Message::unskipTextSelection(TextSelection selection) const {
if (!hasVisibleText()) {
return selection;
}
return HistoryView::ShiftItemSelection(selection, text());
}
@@ -3160,6 +3167,17 @@ bool Message::hasVisibleText() const {
return !media || !media->hideMessageText();
}
int Message::visibleTextLength() const {
return hasVisibleText() ? text().length() : 0;
}
int Message::visibleMediaTextLength() const {
const auto media = this->media();
return (media && media->isDisplayed())
? media->fullSelectionLength()
: 0;
}
QSize Message::performCountCurrentSize(int newWidth) {
const auto newHeight = resizeContentGetHeight(newWidth);

View File

@@ -226,6 +226,8 @@ private:
QSize performCountOptimalSize() override;
QSize performCountCurrentSize(int newWidth) override;
bool hasVisibleText() const override;
[[nodiscard]] int visibleTextLength() const;
[[nodiscard]] int visibleMediaTextLength() const;
[[nodiscard]] bool needInfoDisplay() const;
[[nodiscard]] bool isPinnedContext() const;

View File

@@ -15,52 +15,26 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/weak_ptr.h"
namespace HistoryView {
namespace {
class AnimatedSpoilerClickHandler final : public ClickHandler {
public:
AnimatedSpoilerClickHandler(
not_null<Element*> view,
Ui::Text::String &text);
void onClick(ClickContext context) const override;
private:
base::weak_ptr<Element> _weak;
Ui::Text::String &_text;
};
AnimatedSpoilerClickHandler::AnimatedSpoilerClickHandler(
not_null<Element*> view,
Ui::Text::String &text)
: _weak(view)
, _text(text) {
}
void AnimatedSpoilerClickHandler::onClick(ClickContext context) const {
const auto button = context.button;
const auto view = _weak.get();
if (button != Qt::LeftButton || !view) {
return;
}
const auto my = context.other.value<ClickHandlerContext>();
if (const auto d = my.elementDelegate ? my.elementDelegate() : nullptr) {
_text.setSpoilerRevealed(true, anim::type::normal);
if (const auto controller = my.sessionWindow.get()) {
controller->session().data().registerShownSpoiler(view);
}
}
}
} // namespace
void FillTextWithAnimatedSpoilers(
not_null<Element*> view,
Ui::Text::String &text) {
if (text.hasSpoilers()) {
text.setSpoilerLink(
std::make_shared<AnimatedSpoilerClickHandler>(view, text));
text.setSpoilerLinkFilter([weak = base::make_weak(view.get())](
const ClickContext &context) {
const auto my = context.other.value<ClickHandlerContext>();
const auto button = context.button;
const auto view = weak.get();
if (button != Qt::LeftButton || !view || !my.elementDelegate) {
return false;
} else if (const auto d = my.elementDelegate()) {
if (const auto controller = my.sessionWindow.get()) {
controller->session().data().registerShownSpoiler(view);
}
return true;
}
return false;
});
}
}

View File

@@ -247,7 +247,17 @@ void Game::draw(Painter &p, const PaintContext &context) const {
endskip = _parent->skipBlockWidth();
}
_parent->prepareCustomEmojiPaint(p, context, _description);
_description.drawLeftElided(p, padding.left(), tshift, paintw, width(), _descriptionLines, style::al_left, 0, -1, endskip, false, toDescriptionSelection(context.selection));
_description.draw(p, {
.position = { padding.left(), tshift },
.outerWidth = width(),
.availableWidth = paintw,
.spoiler = Ui::Text::DefaultSpoilerCache(),
.now = context.now,
.paused = context.paused,
.selection = toDescriptionSelection(context.selection),
.elisionLines = _descriptionLines,
.elisionRemoveFromEnd = endskip,
});
tshift += _descriptionLines * lineHeight;
}
if (_attach) {

View File

@@ -228,7 +228,16 @@ void Invoice::draw(Painter &p, const PaintContext &context) const {
}
if (_descriptionHeight) {
p.setPen(stm->historyTextFg);
_description.drawLeft(p, padding.left(), tshift, paintw, width(), style::al_left, 0, -1, toDescriptionSelection(context.selection));
_parent->prepareCustomEmojiPaint(p, context, _description);
_description.draw(p, {
.position = { padding.left(), tshift },
.outerWidth = width(),
.availableWidth = paintw,
.spoiler = Ui::Text::DefaultSpoilerCache(),
.now = context.now,
.paused = context.paused,
.selection = toDescriptionSelection(context.selection),
});
tshift += _descriptionHeight;
}
if (_attach) {
@@ -353,6 +362,17 @@ void Invoice::clickHandlerPressedChanged(const ClickHandlerPtr &p, bool pressed)
}
}
bool Invoice::hasHeavyPart() const {
return _attach ? _attach->hasHeavyPart() : false;
}
void Invoice::unloadHeavyPart() {
if (_attach) {
_attach->unloadHeavyPart();
}
_description.unloadPersistentAnimation();
}
TextForMimeData Invoice::selectedText(TextSelection selection) const {
auto titleResult = _title.toTextForMimeData(selection);
auto descriptionResult = _description.toTextForMimeData(

View File

@@ -70,14 +70,8 @@ public:
return _attach.get();
}
bool hasHeavyPart() const override {
return _attach ? _attach->hasHeavyPart() : false;
}
void unloadHeavyPart() override {
if (_attach) {
_attach->unloadHeavyPart();
}
}
bool hasHeavyPart() const override;
void unloadHeavyPart() override;
private:
QSize countOptimalSize() override;

View File

@@ -568,13 +568,20 @@ void WebPage::draw(Painter &p, const PaintContext &context) const {
endskip = _parent->skipBlockWidth();
}
_parent->prepareCustomEmojiPaint(p, context, _description);
if (_descriptionLines > 0) {
_description.drawLeftElided(p, padding.left(), tshift, paintw, width(), _descriptionLines, style::al_left, 0, -1, endskip, false, toDescriptionSelection(context.selection));
tshift += _descriptionLines * lineHeight;
} else {
_description.drawLeft(p, padding.left(), tshift, paintw, width(), style::al_left, 0, -1, toDescriptionSelection(context.selection));
tshift += _description.countHeight(paintw);
}
_description.draw(p, {
.position = { padding.left(), tshift },
.outerWidth = width(),
.availableWidth = paintw,
.spoiler = Ui::Text::DefaultSpoilerCache(),
.now = context.now,
.paused = context.paused,
.selection = toDescriptionSelection(context.selection),
.elisionLines = std::max(_descriptionLines, 0),
.elisionRemoveFromEnd = (_descriptionLines > 0) ? endskip : 0,
});
tshift += (_descriptionLines > 0)
? (_descriptionLines * lineHeight)
: _description.countHeight(paintw);
}
if (_attach) {
auto attachAtTop = !_siteNameLines && !_titleLines && !_descriptionLines;

View File

@@ -2284,6 +2284,12 @@ void OverlayWidget::refreshCaption() {
: AddTimestampLinks(caption, duration, base)),
Ui::ItemTextOptions(_message),
context);
if (_caption.hasSpoilers()) {
const auto weak = Ui::MakeWeak(widget());
_caption.setSpoilerLinkFilter([=](const ClickContext &context) {
return (weak != nullptr);
});
}
}
void OverlayWidget::refreshGroupThumbs() {

View File

@@ -21,7 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/unixtime.h"
#include "base/platform/base_platform_info.h"
#include <KSandbox>
#include <ksandbox.h>
#include <zlib.h>
namespace MTP {

View File

@@ -35,8 +35,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QtWidgets/QSystemTrayIcon>
#include <QtCore/QStandardPaths>
#include <QtCore/QProcess>
#include <KShell>
#include <KSandbox>
#include <kshell.h>
#include <ksandbox.h>
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
#include <glibmm.h>

View File

@@ -526,11 +526,13 @@ void FilterRowButton::paintEvent(QPaintEvent *e) {
return [=] {
auto ids = prepareGoodIdsForNewFilters();
using Requests = std::vector<MTPmessages_UpdateDialogFilter>;
auto addRequests = Requests(), removeRequests = Requests();
auto order = std::vector<FilterId>();
auto updates = std::vector<MTPUpdate>();
auto addRequests = std::vector<MTPmessages_UpdateDialogFilter>();
auto removeRequests = std::vector<MTPmessages_UpdateDialogFilter>();
auto &realFilters = session->data().chatsFilters();
const auto &list = realFilters.list();
auto order = std::vector<FilterId>();
order.reserve(rows->size());
for (const auto &row : *rows) {
const auto id = row.filter.id();
@@ -558,7 +560,7 @@ void FilterRowButton::paintEvent(QPaintEvent *e) {
addRequests.push_back(request);
order.push_back(newId);
}
realFilters.apply(MTP_updateDialogFilter(
updates.push_back(MTP_updateDialogFilter(
MTP_flags(removed
? MTPDupdateDialogFilter::Flag(0)
: MTPDupdateDialogFilter::Flag::f_filter),
@@ -578,16 +580,31 @@ void FilterRowButton::paintEvent(QPaintEvent *e) {
}
order.insert(order.begin() + position, FilterId(0));
}
auto previousId = mtpRequestId(0);
auto &&requests = ranges::views::concat(removeRequests, addRequests);
for (auto &request : requests) {
previousId = session->api().request(
std::move(request)
).afterRequest(previousId).send();
}
if (!order.empty() && !addRequests.empty()) {
realFilters.saveOrder(order, previousId);
}
crl::on_main(session, [
session,
order = std::move(order),
updates = std::move(updates),
addRequests = std::move(addRequests),
removeRequests = std::move(removeRequests)
] {
const auto api = &session->api();
const auto filters = &session->data().chatsFilters();
for (const auto &update : updates) {
filters->apply(update);
}
auto previousId = mtpRequestId(0);
auto &&requests = ranges::views::concat(
removeRequests,
addRequests);
for (auto &request : requests) {
previousId = api->request(
std::move(request)
).afterRequest(previousId).send();
}
if (!order.empty() && !addRequests.empty()) {
filters->saveOrder(order, previousId);
}
});
};
}

View File

@@ -580,7 +580,7 @@ void EmojiStatusTopBar::paint(QPainter &p) {
crl::now(),
_paused);
p.drawImage(_rect, frame.image);
p.drawImage(_rect.toRect(), frame.image);
if (!_paused) {
_player->markFrameShown();
}
@@ -675,7 +675,7 @@ TopBarUser::TopBarUser(
if (document) {
_emojiStatus = std::make_unique<EmojiStatusTopBar>(
document,
[=](QRect r) { update(std::move(r)); },
[=](QRect r) { _content->update(std::move(r)); },
HistoryView::Sticker::EmojiSize());
_imageStar = QImage();
} else {
@@ -1650,7 +1650,10 @@ QPointer<Ui::RpWidget> Premium::createPinnedToBottom(
_radioGroup->setChangedCallback([=](int value) {
const auto options =
_controller->session().api().premium().subscriptionOptions();
Expects(value < options.size() && value >= 0);
if (options.empty()) {
return;
}
Assert(value < options.size() && value >= 0);
auto text = tr::lng_premium_subscribe_button(
tr::now,
lt_cost,
@@ -1783,7 +1786,7 @@ not_null<Ui::GradientButton*> CreateSubscribeButton(
controller = args.controller,
computeRef = args.computeRef,
computeBotUrl = args.computeBotUrl] {
const auto url = computeBotUrl ? QString() : computeBotUrl();
const auto url = computeBotUrl ? computeBotUrl() : QString();
if (!url.isEmpty()) {
const auto local = Core::TryConvertUrlToLocal(url);
if (local.isEmpty()) {

View File

@@ -88,14 +88,15 @@ void PrepareDetailsInParallel(PreparedList &result, int previewWidth) {
} // namespace
bool ValidatePhotoEditorMediaDragData(not_null<const QMimeData*> data) {
if (base::GetMimeUrls(data).size() > 1) {
const auto urls = base::GetMimeUrls(data);
if (urls.size() > 1) {
return false;
} else if (data->hasImage()) {
return true;
}
if (data->hasUrls()) {
const auto url = base::GetMimeUrls(data).front();
if (!urls.isEmpty()) {
const auto url = urls.front();
if (url.isLocalFile()) {
using namespace Core;
const auto info = QFileInfo(Platform::File::UrlToLocal(url));
@@ -111,14 +112,15 @@ bool ValidatePhotoEditorMediaDragData(not_null<const QMimeData*> data) {
bool ValidateEditMediaDragData(
not_null<const QMimeData*> data,
Ui::AlbumType albumType) {
if (base::GetMimeUrls(data).size() > 1) {
const auto urls = base::GetMimeUrls(data);
if (urls.size() > 1) {
return false;
} else if (data->hasImage()) {
return (albumType != Ui::AlbumType::Music);
}
if (albumType == Ui::AlbumType::PhotoVideo && data->hasUrls()) {
const auto url = base::GetMimeUrls(data).front();
if (albumType == Ui::AlbumType::PhotoVideo && !urls.isEmpty()) {
const auto url = urls.front();
if (url.isLocalFile()) {
using namespace Core;
const auto info = QFileInfo(Platform::File::UrlToLocal(url));
@@ -138,12 +140,7 @@ MimeDataState ComputeMimeDataState(const QMimeData *data) {
return MimeDataState::Image;
}
const auto uriListFormat = qsl("text/uri-list");
if (!data->hasFormat(uriListFormat)) {
return MimeDataState::None;
}
const auto &urls = base::GetMimeUrls(data);
const auto urls = base::GetMimeUrls(data);
if (urls.isEmpty()) {
return MimeDataState::None;
}

View File

@@ -24,7 +24,7 @@ MiniStars::MiniStars(Fn<void(const QRect &r)> updateCallback, bool opaque)
Interval{ 180 + 15, 50 },
Interval{ -15 - 50, 50 },
})
, _lifeLength({ 150, 200 })
, _lifeLength({ 150 / 5, 200 / 5 })
, _deathTime({ 1500, 2000 })
, _size({ 5, 10 })
, _alpha({ opaque ? 100 : 40, opaque ? 100 : 60 })

View File

@@ -1,7 +1,7 @@
{%- set GIT = "https://github.com" -%}
{%- set GIT_FREEDESKTOP = GIT ~ "/gitlab-freedesktop-mirrors" -%}
{%- set QT = "6_4_0" -%}
{%- set QT_TAG = "v6.4.0-rc1" -%}
{%- set QT_TAG = "v6.4.0" -%}
{%- set QT_PREFIX = "/usr/local/desktop-app/Qt-6.4.0" -%}
{%- set OPENSSL_VER = "1_1_1" -%}
{%- set OPENSSL_PREFIX = "/usr/local/desktop-app/openssl-1.1.1" -%}
@@ -62,15 +62,6 @@ RUN git clone -b nasm-2.15.05 --depth=1 {{ GIT }}/netwide-assembler/nasm.git \
&& cd .. \
&& rm -rf nasm
FROM builder AS extra-cmake-modules
RUN git clone -b v5.98.0 --depth=1 {{ GIT }}/KDE/extra-cmake-modules.git \
&& cd extra-cmake-modules \
&& cmake -GNinja -B build . -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF \
&& cmake --build build --parallel \
&& DESTDIR="{{ LibrariesPath }}/extra-cmake-modules-cache" cmake --install build \
&& cd .. \
&& rm -rf extra-cmake-modules
FROM builder AS libffi
RUN git clone -b v3.4.2 --depth=1 {{ GIT }}/libffi/libffi.git \
&& cd libffi \
@@ -251,7 +242,7 @@ COPY --link --from=lcms2 {{ LibrariesPath }}/lcms2-cache /
COPY --link --from=brotli {{ LibrariesPath }}/brotli-cache /
COPY --link --from=highway {{ LibrariesPath }}/highway-cache /
RUN git clone -b v0.7rc --depth=1 {{ GIT }}/libjxl/libjxl.git \
RUN git clone -b v0.7.0 --depth=1 {{ GIT }}/libjxl/libjxl.git \
&& cd libjxl \
&& cmake -GNinja -B build . \
-DCMAKE_BUILD_TYPE=Release \
@@ -718,39 +709,6 @@ RUN git clone -b {{ QT_TAG }} --depth=1 git://code.qt.io/qt/qt5.git qt_{{ QT }}
&& cd .. \
&& rm -rf qt_{{ QT }}
FROM patches AS kcoreaddons
COPY --link --from=extra-cmake-modules {{ LibrariesPath }}/extra-cmake-modules-cache /
COPY --link --from=libffi {{ LibrariesPath }}/libffi-cache /
COPY --link --from=zlib {{ LibrariesPath }}/zlib-cache /
COPY --link --from=libproxy {{ LibrariesPath }}/libproxy-cache /
COPY --link --from=mozjpeg {{ LibrariesPath }}/mozjpeg-cache /
COPY --link --from=xcb {{ LibrariesPath }}/xcb-cache /
COPY --link --from=xcb-wm {{ LibrariesPath }}/xcb-wm-cache /
COPY --link --from=xcb-util {{ LibrariesPath }}/xcb-util-cache /
COPY --link --from=xcb-image {{ LibrariesPath }}/xcb-image-cache /
COPY --link --from=xcb-keysyms {{ LibrariesPath }}/xcb-keysyms-cache /
COPY --link --from=xcb-render-util {{ LibrariesPath }}/xcb-render-util-cache /
COPY --link --from=wayland {{ LibrariesPath }}/wayland-cache /
COPY --link --from=openssl {{ LibrariesPath }}/openssl-cache /
COPY --link --from=xkbcommon {{ LibrariesPath }}/xkbcommon-cache /
COPY --link --from=qt {{ LibrariesPath }}/qt-cache /
RUN git clone -b v5.98.0 --depth=1 {{ GIT }}/KDE/kcoreaddons.git \
&& cd kcoreaddons \
&& curl -sSL https://invent.kde.org/frameworks/kcoreaddons/-/merge_requests/258.patch | git apply \
&& rm -rf po \
&& cmake -GNinja -B build . \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH={{ QT_PREFIX }} \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_TESTING=OFF \
-DBUILD_WITH_QT6=ON \
-DEXCLUDE_DEPRECATED_BEFORE_AND_AT=5.78.0 \
&& cmake --build build --parallel \
&& DESTDIR="{{ LibrariesPath }}/kcoreaddons-cache" cmake --install build \
&& cd .. \
&& rm -rf kcoreaddons
FROM patches AS breakpad
RUN git clone https://chromium.googlesource.com/breakpad/breakpad.git \
&& cd breakpad \
@@ -846,7 +804,6 @@ COPY --link --from=xkbcommon {{ LibrariesPath }}/xkbcommon-cache /
COPY --link --from=libsigcplusplus {{ LibrariesPath }}/libsigcplusplus-cache /
COPY --link --from=glibmm {{ LibrariesPath }}/glibmm-cache /
COPY --link --from=qt {{ LibrariesPath }}/qt-cache /
COPY --link --from=kcoreaddons {{ LibrariesPath }}/kcoreaddons-cache /
COPY --link --from=breakpad {{ LibrariesPath }}/breakpad-cache /
COPY --link --from=webrtc {{ LibrariesPath }}/tg_owt tg_owt
COPY --link --from=webrtc_release {{ LibrariesPath }}/tg_owt/out/Release tg_owt/out/Release

View File

@@ -82,6 +82,7 @@ environment = {
'USED_PREFIX': usedPrefix,
'ROOT_DIR': rootDir,
'LIBS_DIR': libsDir,
'THIRDPARTY_DIR': thirdPartyDir,
'SPECIAL_TARGET': 'win' if win32 else 'win64' if win64 else 'mac',
'X8664': 'x86' if win32 else 'x64',
'WIN32X64': 'Win32' if win32 else 'x64',
@@ -446,8 +447,10 @@ win:
depends:patches/gyp.diff
git apply $LIBS_DIR/patches/gyp.diff
mac:
python3 -m pip install --ignore-installed git+https://github.com/desktop-app/gyp-next@main
mkdir gyp
python3 -m pip install ^
--ignore-installed ^
--target=$THIRDPARTY_DIR/gyp ^
git+https://chromium.googlesource.com/external/gyp@master
""", 'ThirdParty')
stage('yasm', """
@@ -1033,6 +1036,7 @@ depends:patches/breakpad.diff
cd src/third_party/lss
git checkout e1e7b0ad8e
cd ../../build
PYTHONPATH=$THIRDPARTY_DIR/gyp
python3 gyp_breakpad
cd ../processor
xcodebuild -project processor.xcodeproj -target minidump_stackwalk -configuration Release build

View File

@@ -1,7 +1,7 @@
AppVersion 4002001
AppVersion 4002004
AppVersionStrMajor 4.2
AppVersionStrSmall 4.2.1
AppVersionStr 4.2.1
BetaChannel 1
AppVersionStrSmall 4.2.4
AppVersionStr 4.2.4
BetaChannel 0
AlphaVersion 0
AppVersionOriginal 4.2.1.beta
AppVersionOriginal 4.2.4

View File

@@ -1,3 +1,19 @@
4.2.4 (30.09.22)
- Fix crash in emoji statuses clearing.
4.2.3 (28.09.22)
- Improve scaling / cropping for photos / video files.
- Improve touch support in channel comments.
- Nice animation for spoilers.
4.2.2 beta (23.09.22)
- Fix crash in spoiler revealing in media captions.
- Fix spoiler revealing in media viewer captions.
- Fix crash in folder editing on Linux.
4.2.1 beta (22.09.22)
- Improve scaling / cropping for photos / video files.

2
cmake

Submodule cmake updated: 848c16578e...84f43a8252

View File

@@ -156,7 +156,6 @@ parts:
after:
- desktop-qt
- ffmpeg
- kcoreaddons
- libjxl
- mozjpeg
- openal
@@ -200,17 +199,6 @@ parts:
- mozjpeg
- qt
extra-cmake-modules:
source: https://github.com/KDE/extra-cmake-modules.git
source-depth: 1
source-tag: v5.98.0
plugin: cmake
cmake-parameters:
- -DCMAKE_BUILD_TYPE=Release
- -DCMAKE_INSTALL_PREFIX=/usr
- -DBUILD_TESTING=OFF
prime: [-./*]
ffmpeg:
plugin: nil
build-packages:
@@ -230,46 +218,11 @@ parts:
after:
- mozjpeg
kcoreaddons:
source: https://github.com/KDE/kcoreaddons.git
source-depth: 1
source-tag: v5.98.0
plugin: cmake
build-packages:
- curl
cmake-parameters:
- -DCMAKE_BUILD_TYPE=Release
- -DCMAKE_INSTALL_PREFIX=/usr
- -DBUILD_TESTING=OFF
- -DBUILD_WITH_QT6=ON
- -DEXCLUDE_DEPRECATED_BEFORE_AND_AT=5.78.0
override-pull: |
snapcraftctl pull
curl -sSL https://invent.kde.org/frameworks/kcoreaddons/-/merge_requests/258.patch | git apply
rm -rf po
prime:
- -./usr/bin
- -./usr/include
- -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/cmake
- -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/*.so
- -./usr/mkspecs
after:
- extra-cmake-modules
- desktop-qt
libjxl:
source: https://github.com/libjxl/libjxl.git
source-depth: 1
source-tag: v0.7rc
source-tag: v0.7.0
plugin: cmake
build-packages:
- libbrotli-dev
- libhwy-dev
- liblcms2-dev
stage-packages:
- libbrotli1
- libhwy0
- liblcms2-2
cmake-parameters:
- -DCMAKE_BUILD_TYPE=Release
- -DCMAKE_INSTALL_PREFIX=/usr
@@ -284,10 +237,16 @@ parts:
- -DJPEGXL_ENABLE_SJPEG=OFF
- -DJPEGXL_ENABLE_OPENEXR=OFF
- -DJPEGXL_ENABLE_SKCMS=OFF
override-pull: |
craftctl default
sed -i 's/NOT JPEGXL_ENABLE_SKCMS/0/' lib/jxl.cmake
stage:
- -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/libbrotli*
prime:
- -./usr/bin
- -./usr/include
- -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pkgocnfig
- -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/pkgconfig
- -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/*.a
- -./usr/lib/$SNAPCRAFT_ARCH_TRIPLET/*.so
- -./usr/share
@@ -440,7 +399,7 @@ parts:
override-pull: |
QT=6_4_0
git clone -b v6.4.0-rc1 --depth=1 git://code.qt.io/qt/qt5.git .
git clone -b v6.4.0 --depth=1 git://code.qt.io/qt/qt5.git .
perl init-repository --module-subset=qtbase,qtwayland,qtimageformats,qtsvg,qt5compat
cd qtbase