mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix build with updated submodules.
This commit is contained in:
parent
b412b2141e
commit
cdc295c1d7
8 changed files with 54 additions and 72 deletions
|
@ -326,7 +326,9 @@ void StickersBox::prepare() {
|
||||||
_session->api().updateStickers();
|
_session->api().updateStickers();
|
||||||
|
|
||||||
if (_installed.widget()) {
|
if (_installed.widget()) {
|
||||||
connect(_installed.widget(), SIGNAL(draggingScrollDelta(int)), this, SLOT(onDraggingScrollDelta(int)));
|
connect(_installed.widget(), &Inner::draggingScrollDelta, [=](int delta) {
|
||||||
|
scrollByDraggingDelta(delta);
|
||||||
|
});
|
||||||
if (!_megagroupSet) {
|
if (!_megagroupSet) {
|
||||||
boxClosing() | rpl::start_with_next([=] {
|
boxClosing() | rpl::start_with_next([=] {
|
||||||
saveChanges();
|
saveChanges();
|
||||||
|
|
|
@ -61,68 +61,68 @@ void UiIntegration::startFontsEnd() {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<ClickHandler> UiIntegration::createLinkHandler(
|
std::shared_ptr<ClickHandler> UiIntegration::createLinkHandler(
|
||||||
EntityType type,
|
const EntityLinkData &data,
|
||||||
const QString &text,
|
const std::any &context) {
|
||||||
const QString &data,
|
const auto my = std::any_cast<Context>(&context);
|
||||||
const TextParseOptions &options) {
|
switch (data.type) {
|
||||||
switch (type) {
|
|
||||||
case EntityType::Url:
|
case EntityType::Url:
|
||||||
return (!data.isEmpty() && UrlClickHandler::IsSuspicious(data))
|
return (!data.data.isEmpty()
|
||||||
? std::make_shared<HiddenUrlClickHandler>(data)
|
&& UrlClickHandler::IsSuspicious(data.data))
|
||||||
: nullptr;
|
? std::make_shared<HiddenUrlClickHandler>(data.data)
|
||||||
|
: Integration::createLinkHandler(data, context);
|
||||||
|
|
||||||
case EntityType::CustomUrl:
|
case EntityType::CustomUrl:
|
||||||
return !data.isEmpty()
|
return !data.data.isEmpty()
|
||||||
? std::make_shared<HiddenUrlClickHandler>(data)
|
? std::make_shared<HiddenUrlClickHandler>(data.data)
|
||||||
: nullptr;
|
: Integration::createLinkHandler(data, context);
|
||||||
|
|
||||||
case EntityType::BotCommand:
|
case EntityType::BotCommand:
|
||||||
return std::make_shared<BotCommandClickHandler>(data);
|
return std::make_shared<BotCommandClickHandler>(data.data);
|
||||||
|
|
||||||
case EntityType::Hashtag:
|
case EntityType::Hashtag:
|
||||||
if (options.flags & TextTwitterMentions) {
|
if (my && my->type == HashtagMentionType::Twitter) {
|
||||||
return std::make_shared<UrlClickHandler>(
|
return std::make_shared<UrlClickHandler>(
|
||||||
(qsl("https://twitter.com/hashtag/")
|
(qsl("https://twitter.com/hashtag/")
|
||||||
+ data.mid(1)
|
+ data.data.mid(1)
|
||||||
+ qsl("?src=hash")),
|
+ qsl("?src=hash")),
|
||||||
true);
|
true);
|
||||||
} else if (options.flags & TextInstagramMentions) {
|
} else if (my && my->type == HashtagMentionType::Instagram) {
|
||||||
return std::make_shared<UrlClickHandler>(
|
return std::make_shared<UrlClickHandler>(
|
||||||
(qsl("https://instagram.com/explore/tags/")
|
(qsl("https://instagram.com/explore/tags/")
|
||||||
+ data.mid(1)
|
+ data.data.mid(1)
|
||||||
+ '/'),
|
+ '/'),
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
return std::make_shared<HashtagClickHandler>(data);
|
return std::make_shared<HashtagClickHandler>(data.data);
|
||||||
|
|
||||||
case EntityType::Cashtag:
|
case EntityType::Cashtag:
|
||||||
return std::make_shared<CashtagClickHandler>(data);
|
return std::make_shared<CashtagClickHandler>(data.data);
|
||||||
|
|
||||||
case EntityType::Mention:
|
case EntityType::Mention:
|
||||||
if (options.flags & TextTwitterMentions) {
|
if (my && my->type == HashtagMentionType::Twitter) {
|
||||||
return std::make_shared<UrlClickHandler>(
|
return std::make_shared<UrlClickHandler>(
|
||||||
qsl("https://twitter.com/") + data.mid(1),
|
qsl("https://twitter.com/") + data.data.mid(1),
|
||||||
true);
|
true);
|
||||||
} else if (options.flags & TextInstagramMentions) {
|
} else if (my && my->type == HashtagMentionType::Instagram) {
|
||||||
return std::make_shared<UrlClickHandler>(
|
return std::make_shared<UrlClickHandler>(
|
||||||
qsl("https://instagram.com/") + data.mid(1) + '/',
|
qsl("https://instagram.com/") + data.data.mid(1) + '/',
|
||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
return std::make_shared<MentionClickHandler>(data);
|
return std::make_shared<MentionClickHandler>(data.data);
|
||||||
|
|
||||||
case EntityType::MentionName: {
|
case EntityType::MentionName: {
|
||||||
auto fields = TextUtilities::MentionNameDataToFields(data);
|
auto fields = TextUtilities::MentionNameDataToFields(data.data);
|
||||||
if (fields.userId) {
|
if (fields.userId) {
|
||||||
return std::make_shared<MentionNameClickHandler>(
|
return std::make_shared<MentionNameClickHandler>(
|
||||||
text,
|
data.text,
|
||||||
fields.userId,
|
fields.userId,
|
||||||
fields.accessHash);
|
fields.accessHash);
|
||||||
} else {
|
} else {
|
||||||
LOG(("Bad mention name: %1").arg(data));
|
LOG(("Bad mention name: %1").arg(data.data));
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return Integration::createLinkHandler(data, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UiIntegration::handleUrlClick(
|
bool UiIntegration::handleUrlClick(
|
||||||
|
|
|
@ -13,6 +13,15 @@ namespace Core {
|
||||||
|
|
||||||
class UiIntegration : public Ui::Integration {
|
class UiIntegration : public Ui::Integration {
|
||||||
public:
|
public:
|
||||||
|
enum class HashtagMentionType : uchar {
|
||||||
|
Telegram,
|
||||||
|
Twitter,
|
||||||
|
Instagram,
|
||||||
|
};
|
||||||
|
struct Context {
|
||||||
|
HashtagMentionType type = HashtagMentionType::Telegram;
|
||||||
|
};
|
||||||
|
|
||||||
void postponeCall(FnMut<void()> &&callable) override;
|
void postponeCall(FnMut<void()> &&callable) override;
|
||||||
void registerLeaveSubscription(not_null<QWidget*> widget) override;
|
void registerLeaveSubscription(not_null<QWidget*> widget) override;
|
||||||
void unregisterLeaveSubscription(not_null<QWidget*> widget) override;
|
void unregisterLeaveSubscription(not_null<QWidget*> widget) override;
|
||||||
|
@ -27,10 +36,8 @@ public:
|
||||||
void startFontsEnd() override;
|
void startFontsEnd() override;
|
||||||
|
|
||||||
std::shared_ptr<ClickHandler> createLinkHandler(
|
std::shared_ptr<ClickHandler> createLinkHandler(
|
||||||
EntityType type,
|
const EntityLinkData &data,
|
||||||
const QString &text,
|
const std::any &context) override;
|
||||||
const QString &data,
|
|
||||||
const TextParseOptions &options) override;
|
|
||||||
bool handleUrlClick(
|
bool handleUrlClick(
|
||||||
const QString &url,
|
const QString &url,
|
||||||
const QVariant &context) override;
|
const QVariant &context) override;
|
||||||
|
|
|
@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
#include "core/click_handler_types.h"
|
#include "core/click_handler_types.h"
|
||||||
|
#include "core/ui_integration.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "history/history_item_components.h"
|
#include "history/history_item_components.h"
|
||||||
#include "history/history_item.h"
|
#include "history/history_item.h"
|
||||||
|
@ -199,10 +200,17 @@ QSize WebPage::countOptimalSize() {
|
||||||
- st::msgPadding.right()
|
- st::msgPadding.right()
|
||||||
- st::webPageLeft);
|
- st::webPageLeft);
|
||||||
}
|
}
|
||||||
|
auto context = Core::UiIntegration::Context();
|
||||||
|
if (_data->siteName == qstr("Twitter")) {
|
||||||
|
context.type = Core::UiIntegration::HashtagMentionType::Twitter;
|
||||||
|
} else if (_data->siteName == qstr("Instagram")) {
|
||||||
|
context.type = Core::UiIntegration::HashtagMentionType::Instagram;
|
||||||
|
}
|
||||||
_description.setMarkedText(
|
_description.setMarkedText(
|
||||||
st::webPageDescriptionStyle,
|
st::webPageDescriptionStyle,
|
||||||
text,
|
text,
|
||||||
Ui::WebpageTextDescriptionOptions(_data->siteName));
|
Ui::WebpageTextDescriptionOptions(),
|
||||||
|
context);
|
||||||
}
|
}
|
||||||
if (!displayedSiteName().isEmpty()) {
|
if (!displayedSiteName().isEmpty()) {
|
||||||
_siteNameLines = 1;
|
_siteNameLines = 1;
|
||||||
|
|
|
@ -110,32 +110,6 @@ TextParseOptions WebpageDescriptionOptions = {
|
||||||
Qt::LayoutDirectionAuto, // dir
|
Qt::LayoutDirectionAuto, // dir
|
||||||
};
|
};
|
||||||
|
|
||||||
TextParseOptions TwitterDescriptionOptions = {
|
|
||||||
TextParseLinks
|
|
||||||
| TextParseMentions
|
|
||||||
| TextTwitterMentions
|
|
||||||
| TextParseHashtags
|
|
||||||
| TextTwitterHashtags
|
|
||||||
| TextParseMultiline
|
|
||||||
| TextParseRichText, // flags
|
|
||||||
0, // maxw
|
|
||||||
0, // maxh
|
|
||||||
Qt::LayoutDirectionAuto, // dir
|
|
||||||
};
|
|
||||||
|
|
||||||
TextParseOptions InstagramDescriptionOptions = {
|
|
||||||
TextParseLinks
|
|
||||||
| TextParseMentions
|
|
||||||
| TextInstagramMentions
|
|
||||||
| TextParseHashtags
|
|
||||||
| TextInstagramHashtags
|
|
||||||
| TextParseMultiline
|
|
||||||
| TextParseRichText, // flags
|
|
||||||
0, // maxw
|
|
||||||
0, // maxh
|
|
||||||
Qt::LayoutDirectionAuto, // dir
|
|
||||||
};
|
|
||||||
|
|
||||||
bool UseBotTextOptions(
|
bool UseBotTextOptions(
|
||||||
not_null<History*> history,
|
not_null<History*> history,
|
||||||
not_null<PeerData*> author) {
|
not_null<PeerData*> author) {
|
||||||
|
@ -171,8 +145,6 @@ void InitTextOptions() {
|
||||||
WebpageTitleOptions.maxh = st::webPageTitleFont->height * 2;
|
WebpageTitleOptions.maxh = st::webPageTitleFont->height * 2;
|
||||||
WebpageTitleOptions.maxw
|
WebpageTitleOptions.maxw
|
||||||
= WebpageDescriptionOptions.maxw
|
= WebpageDescriptionOptions.maxw
|
||||||
= TwitterDescriptionOptions.maxw
|
|
||||||
= InstagramDescriptionOptions.maxw
|
|
||||||
= st::msgMaxWidth
|
= st::msgMaxWidth
|
||||||
- st::msgPadding.left()
|
- st::msgPadding.left()
|
||||||
- st::webPageLeft
|
- st::webPageLeft
|
||||||
|
@ -204,13 +176,7 @@ const TextParseOptions &WebpageTextTitleOptions() {
|
||||||
return WebpageTitleOptions;
|
return WebpageTitleOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TextParseOptions &WebpageTextDescriptionOptions(
|
const TextParseOptions &WebpageTextDescriptionOptions() {
|
||||||
const QString &siteName) {
|
|
||||||
if (siteName == qstr("Twitter")) {
|
|
||||||
return TwitterDescriptionOptions;
|
|
||||||
} else if (siteName == qstr("Instagram")) {
|
|
||||||
return InstagramDescriptionOptions;
|
|
||||||
}
|
|
||||||
return WebpageDescriptionOptions;
|
return WebpageDescriptionOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,7 @@ const TextParseOptions &ItemTextBotNoMonoOptions();
|
||||||
const TextParseOptions &ItemTextServiceOptions();
|
const TextParseOptions &ItemTextServiceOptions();
|
||||||
|
|
||||||
const TextParseOptions &WebpageTextTitleOptions();
|
const TextParseOptions &WebpageTextTitleOptions();
|
||||||
const TextParseOptions &WebpageTextDescriptionOptions(
|
const TextParseOptions &WebpageTextDescriptionOptions();
|
||||||
const QString &siteName = QString());
|
|
||||||
|
|
||||||
const TextParseOptions &NameTextOptions();
|
const TextParseOptions &NameTextOptions();
|
||||||
const TextParseOptions &DialogTextOptions();
|
const TextParseOptions &DialogTextOptions();
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 4ef97b57f6925ac9f1e3221676f49dffb4fe8c19
|
Subproject commit 4e6763d1769e6305a3da158e1a332ccd6a30398a
|
2
cmake
2
cmake
|
@ -1 +1 @@
|
||||||
Subproject commit b558136e64edd851901ac2b48a4f186d186c1723
|
Subproject commit eb97b772a330ee370ea37c753a54c6862ca96644
|
Loading…
Add table
Reference in a new issue