init
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
Close stale issues and PRs / stale (push) Has been cancelled
This commit is contained in:
153
Telegram/SourceFiles/ui/text/text_options.cpp
Normal file
153
Telegram/SourceFiles/ui/text/text_options.cpp
Normal file
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "ui/text/text_options.h"
|
||||
|
||||
#include "styles/style_window.h"
|
||||
#include "styles/style_chat.h"
|
||||
|
||||
namespace Ui {
|
||||
namespace {
|
||||
|
||||
TextParseOptions HistoryTextOptions = {
|
||||
TextParseLinks
|
||||
| TextParseMentions
|
||||
| TextParseHashtags
|
||||
| TextParseMultiline
|
||||
| TextParseMarkdown, // flags
|
||||
0, // maxw
|
||||
0, // maxh
|
||||
Qt::LayoutDirectionAuto, // dir
|
||||
};
|
||||
|
||||
TextParseOptions HistoryBotOptions = {
|
||||
TextParseLinks
|
||||
| TextParseMentions
|
||||
| TextParseHashtags
|
||||
| TextParseBotCommands
|
||||
| TextParseMultiline
|
||||
| TextParseMarkdown, // flags
|
||||
0, // maxw
|
||||
0, // maxh
|
||||
Qt::LayoutDirectionAuto, // dir
|
||||
};
|
||||
|
||||
TextParseOptions HistoryServiceOptions = {
|
||||
TextParseLinks
|
||||
| TextParseMentions
|
||||
//| TextParseMultiline
|
||||
| TextParseHashtags
|
||||
| TextParseMarkdown, // flags
|
||||
0, // maxw
|
||||
0, // maxh
|
||||
Qt::LayoutDirectionAuto, // lang-dependent
|
||||
};
|
||||
|
||||
TextParseOptions HistoryTextNoMonoOptions = {
|
||||
TextParseLinks
|
||||
| TextParseMentions
|
||||
| TextParseHashtags
|
||||
| TextParseMultiline, // flags
|
||||
0, // maxw
|
||||
0, // maxh
|
||||
Qt::LayoutDirectionAuto, // dir
|
||||
};
|
||||
|
||||
TextParseOptions HistoryBotNoMonoOptions = {
|
||||
TextParseLinks
|
||||
| TextParseMentions
|
||||
| TextParseHashtags
|
||||
| TextParseBotCommands
|
||||
| TextParseMultiline, // flags
|
||||
0, // maxw
|
||||
0, // maxh
|
||||
Qt::LayoutDirectionAuto, // dir
|
||||
};
|
||||
|
||||
TextParseOptions TextNameOptions = {
|
||||
0, // flags
|
||||
4096, // maxw
|
||||
1, // maxh
|
||||
Qt::LayoutDirectionAuto, // lang-dependent
|
||||
};
|
||||
|
||||
TextParseOptions TextDialogOptions = {
|
||||
TextParseColorized | TextParseMarkdown, // flags
|
||||
0, // maxw is style-dependent
|
||||
1, // maxh
|
||||
Qt::LayoutDirectionAuto, // lang-dependent
|
||||
};
|
||||
|
||||
TextParseOptions WebpageTitleOptions = {
|
||||
TextParseMultiline, // flags
|
||||
0, // maxw
|
||||
0, // maxh
|
||||
Qt::LayoutDirectionAuto, // dir
|
||||
};
|
||||
|
||||
TextParseOptions WebpageDescriptionOptions = {
|
||||
TextParseLinks
|
||||
| TextParseMentions
|
||||
| TextParseHashtags
|
||||
| TextParseMultiline
|
||||
| TextParseMarkdown, // flags
|
||||
0, // maxw
|
||||
0, // maxh
|
||||
Qt::LayoutDirectionAuto, // dir
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
void InitTextOptions() {
|
||||
TextDialogOptions.maxw = st::columnMaximalWidthLeft * 2;
|
||||
WebpageTitleOptions.maxh = st::webPageTitleFont->height * 2;
|
||||
WebpageTitleOptions.maxw
|
||||
= WebpageDescriptionOptions.maxw
|
||||
= st::msgMaxWidth
|
||||
- st::msgPadding.left()
|
||||
- st::messageQuoteStyle.padding.left()
|
||||
- st::messageQuoteStyle.padding.right()
|
||||
- st::msgPadding.right();
|
||||
}
|
||||
|
||||
const TextParseOptions &ItemTextDefaultOptions() {
|
||||
return HistoryTextOptions;
|
||||
}
|
||||
|
||||
const TextParseOptions &ItemTextBotDefaultOptions() {
|
||||
return HistoryBotOptions;
|
||||
}
|
||||
|
||||
const TextParseOptions &ItemTextNoMonoOptions() {
|
||||
return HistoryTextNoMonoOptions;
|
||||
}
|
||||
|
||||
const TextParseOptions &ItemTextBotNoMonoOptions() {
|
||||
return HistoryBotNoMonoOptions;
|
||||
}
|
||||
|
||||
const TextParseOptions &ItemTextServiceOptions() {
|
||||
return HistoryServiceOptions;
|
||||
}
|
||||
|
||||
const TextParseOptions &WebpageTextTitleOptions() {
|
||||
return WebpageTitleOptions;
|
||||
}
|
||||
|
||||
const TextParseOptions &WebpageTextDescriptionOptions() {
|
||||
return WebpageDescriptionOptions;
|
||||
}
|
||||
|
||||
const TextParseOptions &NameTextOptions() {
|
||||
return TextNameOptions;
|
||||
}
|
||||
|
||||
const TextParseOptions &DialogTextOptions() {
|
||||
return TextDialogOptions;
|
||||
}
|
||||
|
||||
} // namespace Ui
|
||||
Reference in New Issue
Block a user