mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-14 13:17:08 +02:00
Show nice padded code blocks.
This commit is contained in:
parent
dd692f2d26
commit
0e79bd3d12
47 changed files with 187 additions and 46 deletions
|
@ -15,6 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "styles/style_calls.h"
|
||||
|
||||
#include <QtCore/QDateTime>
|
||||
#include <QtCore/QLocale>
|
||||
|
||||
namespace Calls::Group::Ui {
|
||||
|
||||
|
|
|
@ -787,7 +787,7 @@ void MessageLinksParser::parse() {
|
|||
}
|
||||
offset = matchOffset = p - start;
|
||||
}
|
||||
processTagsBefore(QFIXED_MAX);
|
||||
processTagsBefore(Ui::kQFixedMax);
|
||||
|
||||
apply(text, ranges);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "countries/countries_instance.h"
|
||||
|
||||
#include "base/qt/qt_common_adapters.h"
|
||||
#include "base/qt/qt_string_view.h"
|
||||
|
||||
namespace Countries {
|
||||
namespace {
|
||||
|
|
|
@ -69,7 +69,7 @@ void ApplyPeerCloudDraft(
|
|||
textWithTags,
|
||||
replyTo,
|
||||
topicRootId,
|
||||
MessageCursor(QFIXED_MAX, QFIXED_MAX, QFIXED_MAX),
|
||||
MessageCursor(Ui::kQFixedMax, Ui::kQFixedMax, Ui::kQFixedMax),
|
||||
(draft.is_no_webpage()
|
||||
? Data::PreviewState::Cancelled
|
||||
: Data::PreviewState::Allowed));
|
||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_statistics_chart.h"
|
||||
|
||||
#include <QtCore/QDateTime>
|
||||
#include <QtCore/QLocale>
|
||||
|
||||
namespace Data {
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ void MessageCursor::fillFrom(not_null<const Ui::InputField*> field) {
|
|||
position = cursor.position();
|
||||
anchor = cursor.anchor();
|
||||
const auto top = field->scrollTop().current();
|
||||
scroll = (top != field->scrollTopMax()) ? top : QFIXED_MAX;
|
||||
scroll = (top != field->scrollTopMax()) ? top : Ui::kQFixedMax;
|
||||
}
|
||||
|
||||
void MessageCursor::applyTo(not_null<Ui::InputField*> field) {
|
||||
|
|
|
@ -7,7 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "ui/text/text.h" // For QFIXED_MAX
|
||||
#include "ui/text/text.h" // Ui::kQFixedMax.
|
||||
#include "data/data_peer_id.h"
|
||||
#include "data/data_msg_id.h"
|
||||
#include "base/qt/qt_compare.h"
|
||||
|
@ -196,7 +196,7 @@ struct MessageCursor {
|
|||
|
||||
int position = 0;
|
||||
int anchor = 0;
|
||||
int scroll = QFIXED_MAX;
|
||||
int scroll = Ui::kQFixedMax;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "base/qt/qt_key_modifiers.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "ui/effects/ripple_animation.h"
|
||||
#include "ui/effects/spoiler_mess.h"
|
||||
#include "ui/image/image.h"
|
||||
#include "ui/toast/toast.h"
|
||||
#include "ui/text/text_options.h"
|
||||
|
@ -260,6 +261,17 @@ void HistoryMessageForwarded::create(const HistoryMessageVia *via) const {
|
|||
}
|
||||
}
|
||||
|
||||
HistoryMessageReply::HistoryMessageReply() = default;
|
||||
|
||||
HistoryMessageReply &HistoryMessageReply::operator=(
|
||||
HistoryMessageReply &&other) = default;
|
||||
|
||||
HistoryMessageReply::~HistoryMessageReply() {
|
||||
// clearData() should be called by holder.
|
||||
Expects(replyToMsg.empty());
|
||||
Expects(replyToVia == nullptr);
|
||||
}
|
||||
|
||||
bool HistoryMessageReply::updateData(
|
||||
not_null<HistoryItem*> holder,
|
||||
bool force) {
|
||||
|
@ -311,7 +323,7 @@ bool HistoryMessageReply::updateData(
|
|||
.customEmojiRepaint = repaint,
|
||||
};
|
||||
replyToText.setMarkedText(
|
||||
st::messageTextStyle,
|
||||
st::defaultTextStyle,
|
||||
(replyToMsg
|
||||
? replyToMsg->inReplyText()
|
||||
: replyToStory->inReplyText()),
|
||||
|
@ -333,7 +345,8 @@ bool HistoryMessageReply::updateData(
|
|||
if (replyToMsg) {
|
||||
const auto peer = replyToMsg->history()->peer;
|
||||
replyToColorKey = (!holder->out()
|
||||
&& (peer->isMegagroup() || peer->isChat()))
|
||||
&& (peer->isMegagroup() || peer->isChat())
|
||||
&& replyToMsg->from()->isUser())
|
||||
? replyToMsg->from()->id
|
||||
: PeerId(0);
|
||||
} else {
|
||||
|
|
|
@ -22,6 +22,7 @@ namespace Ui {
|
|||
struct ChatPaintContext;
|
||||
class ChatStyle;
|
||||
struct PeerUserpicView;
|
||||
class SpoilerAnimation;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Data {
|
||||
|
@ -227,17 +228,13 @@ private:
|
|||
|
||||
struct HistoryMessageReply
|
||||
: public RuntimeComponent<HistoryMessageReply, HistoryItem> {
|
||||
HistoryMessageReply() = default;
|
||||
HistoryMessageReply();
|
||||
HistoryMessageReply(const HistoryMessageReply &other) = delete;
|
||||
HistoryMessageReply(HistoryMessageReply &&other) = delete;
|
||||
HistoryMessageReply &operator=(
|
||||
const HistoryMessageReply &other) = delete;
|
||||
HistoryMessageReply &operator=(HistoryMessageReply &&other) = default;
|
||||
~HistoryMessageReply() {
|
||||
// clearData() should be called by holder.
|
||||
Expects(replyToMsg.empty());
|
||||
Expects(replyToVia == nullptr);
|
||||
}
|
||||
HistoryMessageReply &operator=(HistoryMessageReply &&other);
|
||||
~HistoryMessageReply();
|
||||
|
||||
static constexpr auto kBarAlpha = 230. / 255.;
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/chat/message_bar.h"
|
||||
#include "ui/chat/attach/attach_send_files_way.h"
|
||||
#include "ui/chat/choose_send_as.h"
|
||||
#include "ui/effects/spoiler_mess.h"
|
||||
#include "ui/image/image.h"
|
||||
#include "ui/painter.h"
|
||||
#include "ui/power_saving.h"
|
||||
|
@ -1774,7 +1775,7 @@ bool HistoryWidget::notify_switchInlineBotButtonReceived(
|
|||
MessageCursor cursor = {
|
||||
int(textWithTags.text.size()),
|
||||
int(textWithTags.text.size()),
|
||||
QFIXED_MAX,
|
||||
Ui::kQFixedMax,
|
||||
};
|
||||
_history->setLocalDraft(std::make_unique<Data::Draft>(
|
||||
textWithTags,
|
||||
|
@ -7184,7 +7185,7 @@ void HistoryWidget::editMessage(not_null<HistoryItem*> item) {
|
|||
const auto cursor = MessageCursor {
|
||||
int(editData.text.size()),
|
||||
int(editData.text.size()),
|
||||
QFIXED_MAX
|
||||
Ui::kQFixedMax
|
||||
};
|
||||
const auto previewPage = [&]() -> WebPageData* {
|
||||
if (const auto media = item->media()) {
|
||||
|
@ -7486,7 +7487,7 @@ void HistoryWidget::updatePreview() {
|
|||
Ui::NameTextOptions());
|
||||
auto linkText = QStringView(_previewLinks).split(' ').at(0).toString();
|
||||
_previewDescription.setText(
|
||||
st::messageTextStyle,
|
||||
st::defaultTextStyle,
|
||||
linkText,
|
||||
Ui::DialogTextOptions());
|
||||
|
||||
|
@ -7507,7 +7508,7 @@ void HistoryWidget::updatePreview() {
|
|||
preview.title,
|
||||
Ui::NameTextOptions());
|
||||
_previewDescription.setText(
|
||||
st::messageTextStyle,
|
||||
st::defaultTextStyle,
|
||||
preview.description,
|
||||
Ui::DialogTextOptions());
|
||||
}
|
||||
|
@ -7762,7 +7763,7 @@ void HistoryWidget::updateReplyEditText(not_null<HistoryItem*> item) {
|
|||
.customEmojiRepaint = [=] { updateField(); },
|
||||
};
|
||||
_replyEditMsgText.setMarkedText(
|
||||
st::messageTextStyle,
|
||||
st::defaultTextStyle,
|
||||
item->inReplyText(),
|
||||
Ui::DialogTextOptions(),
|
||||
context);
|
||||
|
|
|
@ -68,6 +68,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/controls/send_as_button.h"
|
||||
#include "ui/controls/silent_toggle.h"
|
||||
#include "ui/chat/choose_send_as.h"
|
||||
#include "ui/effects/spoiler_mess.h"
|
||||
#include "window/window_adaptive.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "mainwindow.h"
|
||||
|
@ -2883,7 +2884,7 @@ void ComposeControls::editMessage(not_null<HistoryItem*> item) {
|
|||
const auto cursor = MessageCursor{
|
||||
int(editData.text.size()),
|
||||
int(editData.text.size()),
|
||||
QFIXED_MAX
|
||||
Ui::kQFixedMax
|
||||
};
|
||||
const auto previewPage = [&]() -> WebPageData* {
|
||||
if (const auto media = item->media()) {
|
||||
|
|
|
@ -216,7 +216,7 @@ void ForwardPanel::updateTexts() {
|
|||
.customEmojiRepaint = _repaint,
|
||||
};
|
||||
_text.setMarkedText(
|
||||
st::messageTextStyle,
|
||||
st::defaultTextStyle,
|
||||
text,
|
||||
Ui::DialogTextOptions(),
|
||||
context);
|
||||
|
|
|
@ -1622,6 +1622,8 @@ void Message::paintText(
|
|||
.position = trect.topLeft(),
|
||||
.availableWidth = trect.width(),
|
||||
.palette = &stm->textPalette,
|
||||
.pre = stm->preBlockCache.get(),
|
||||
.blockquote = stm->blockquoteBlockCache.get(),
|
||||
.colors = context.st->highlightColors(),
|
||||
.spoiler = Ui::Text::DefaultSpoilerCache(),
|
||||
.now = context.now,
|
||||
|
|
|
@ -748,6 +748,8 @@ void Document::draw(
|
|||
.position = { st::msgPadding.left(), captiontop },
|
||||
.availableWidth = captionw,
|
||||
.palette = &stm->textPalette,
|
||||
.pre = stm->preBlockCache.get(),
|
||||
.blockquote = stm->blockquoteBlockCache.get(),
|
||||
.colors = context.st->highlightColors(),
|
||||
.spoiler = Ui::Text::DefaultSpoilerCache(),
|
||||
.now = context.now,
|
||||
|
|
|
@ -235,6 +235,8 @@ void ExtendedPreview::draw(Painter &p, const PaintContext &context) const {
|
|||
painty + painth + st::mediaCaptionSkip),
|
||||
.availableWidth = captionw,
|
||||
.palette = &stm->textPalette,
|
||||
.pre = stm->preBlockCache.get(),
|
||||
.blockquote = stm->blockquoteBlockCache.get(),
|
||||
.colors = context.st->highlightColors(),
|
||||
.spoiler = Ui::Text::DefaultSpoilerCache(),
|
||||
.now = context.now,
|
||||
|
|
|
@ -709,6 +709,8 @@ void Gif::draw(Painter &p, const PaintContext &context) const {
|
|||
.position = QPoint(st::msgPadding.left(), top),
|
||||
.availableWidth = captionw,
|
||||
.palette = &stm->textPalette,
|
||||
.pre = stm->preBlockCache.get(),
|
||||
.blockquote = stm->blockquoteBlockCache.get(),
|
||||
.colors = context.st->highlightColors(),
|
||||
.spoiler = Ui::Text::DefaultSpoilerCache(),
|
||||
.now = context.now,
|
||||
|
|
|
@ -14,6 +14,10 @@ namespace Stickers {
|
|||
struct LargeEmojiImage;
|
||||
} // namespace Stickers
|
||||
|
||||
namespace Ui::Text {
|
||||
class CustomEmoji;
|
||||
} // namespace Ui::Text
|
||||
|
||||
namespace HistoryView {
|
||||
|
||||
using LargeEmojiMedia = std::variant<
|
||||
|
|
|
@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/item_text_options.h"
|
||||
#include "ui/chat/chat_style.h"
|
||||
#include "ui/chat/message_bubble.h"
|
||||
#include "ui/effects/spoiler_mess.h"
|
||||
#include "ui/image/image_prepare.h"
|
||||
#include "ui/power_saving.h"
|
||||
#include "core/ui_integration.h"
|
||||
|
|
|
@ -367,6 +367,9 @@ void GroupedMedia::draw(Painter &p, const PaintContext &context) const {
|
|||
captiony),
|
||||
.availableWidth = captionw,
|
||||
.palette = &stm->textPalette,
|
||||
.pre = stm->preBlockCache.get(),
|
||||
.blockquote = stm->blockquoteBlockCache.get(),
|
||||
.colors = context.st->highlightColors(),
|
||||
.spoiler = Ui::Text::DefaultSpoilerCache(),
|
||||
.now = context.now,
|
||||
.pausedEmoji = context.paused || On(PowerSaving::kEmojiChat),
|
||||
|
|
|
@ -10,6 +10,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/chat/message_bubble.h"
|
||||
#include "ui/effects/animations.h"
|
||||
|
||||
namespace Ui {
|
||||
class SpoilerAnimation;
|
||||
} // namespace Ui
|
||||
|
||||
namespace HistoryView {
|
||||
|
||||
struct MediaSpoiler {
|
||||
|
|
|
@ -405,6 +405,8 @@ void Photo::draw(Painter &p, const PaintContext &context) const {
|
|||
.position = QPoint(st::msgPadding.left(), top),
|
||||
.availableWidth = captionw,
|
||||
.palette = &stm->textPalette,
|
||||
.pre = stm->preBlockCache.get(),
|
||||
.blockquote = stm->blockquoteBlockCache.get(),
|
||||
.colors = context.st->highlightColors(),
|
||||
.spoiler = Ui::Text::DefaultSpoilerCache(),
|
||||
.now = context.now,
|
||||
|
|
|
@ -20,6 +20,10 @@ struct ReactionFlyAnimationArgs;
|
|||
class ReactionFlyAnimation;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Ui::Text {
|
||||
class CustomEmoji;
|
||||
} // namespace Ui::Text
|
||||
|
||||
namespace HistoryView {
|
||||
using PaintContext = Ui::ChatPaintContext;
|
||||
class Message;
|
||||
|
|
|
@ -7,6 +7,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "ui/text/text_custom_emoji.h" // Ui::Text::CustomEmojiFactory.
|
||||
|
||||
namespace Ui {
|
||||
enum class WhoReadType;
|
||||
} // namespace Ui
|
||||
|
|
|
@ -76,6 +76,8 @@ Badge::Badge(
|
|||
}, _lifetime);
|
||||
}
|
||||
|
||||
Badge::~Badge() = default;
|
||||
|
||||
Ui::RpWidget *Badge::widget() const {
|
||||
return _view.data();
|
||||
}
|
||||
|
|
|
@ -27,6 +27,10 @@ class RpWidget;
|
|||
class AbstractButton;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Ui::Text {
|
||||
class CustomEmoji;
|
||||
} // namespace Ui::Text
|
||||
|
||||
namespace Info::Profile {
|
||||
|
||||
class EmojiStatusPanel;
|
||||
|
@ -69,6 +73,8 @@ public:
|
|||
base::flags<BadgeType> allowed
|
||||
= base::flags<BadgeType>::from_raw(-1));
|
||||
|
||||
~Badge();
|
||||
|
||||
[[nodiscard]] Ui::RpWidget *widget() const;
|
||||
|
||||
void setPremiumClickCallback(Fn<void()> callback);
|
||||
|
|
|
@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "lang/lang_keys.h"
|
||||
#include "ui/text/text.h"
|
||||
#include "base/qt/qt_common_adapters.h"
|
||||
#include "base/qt/qt_string_view.h"
|
||||
|
||||
namespace Lang {
|
||||
namespace {
|
||||
|
|
|
@ -596,7 +596,7 @@ bool MainWidget::shareUrl(
|
|||
const auto cursor = MessageCursor{
|
||||
int(url.size()) + 1,
|
||||
int(url.size()) + 1 + int(text.size()),
|
||||
QFIXED_MAX
|
||||
Ui::kQFixedMax
|
||||
};
|
||||
const auto history = thread->owningHistory();
|
||||
const auto topicRootId = thread->topicRootId();
|
||||
|
|
|
@ -346,6 +346,8 @@ Photo::Photo(
|
|||
}
|
||||
}
|
||||
|
||||
Photo::~Photo() = default;
|
||||
|
||||
void Photo::initDimensions() {
|
||||
_maxw = 2 * st::overviewPhotoMinSize;
|
||||
_minh = _story ? qRound(_maxw * kStoryRatio) : _maxw;
|
||||
|
|
|
@ -195,6 +195,7 @@ public:
|
|||
not_null<HistoryItem*> parent,
|
||||
not_null<PhotoData*> photo,
|
||||
MediaOptions options);
|
||||
~Photo();
|
||||
|
||||
void initDimensions() override;
|
||||
int32 resizeGetHeight(int32 width) override;
|
||||
|
|
|
@ -35,6 +35,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include <QtWidgets/QApplication>
|
||||
#include <QtGui/QWindow>
|
||||
#include <QtGui/QScreen>
|
||||
#include <QtCore/QOperatingSystemVersion>
|
||||
|
||||
#include <Shobjidl.h>
|
||||
#include <shellapi.h>
|
||||
|
|
|
@ -73,6 +73,7 @@ private:
|
|||
void validateShadowCache();
|
||||
|
||||
[[nodiscard]] int scaled(int value) const;
|
||||
[[nodiscard]] QPoint scaled(QPoint value) const;
|
||||
[[nodiscard]] QMargins scaled(QMargins value) const;
|
||||
[[nodiscard]] style::font scaled(
|
||||
const style::font &value, int size) const;
|
||||
|
@ -307,6 +308,10 @@ int Preview::scaled(int value) const {
|
|||
return style::ConvertScale(value, _scale);
|
||||
}
|
||||
|
||||
QPoint Preview::scaled(QPoint value) const {
|
||||
return { scaled(value.x()), scaled(value.y()) };
|
||||
}
|
||||
|
||||
QMargins Preview::scaled(QMargins value) const {
|
||||
return {
|
||||
scaled(value.left()),
|
||||
|
@ -328,7 +333,11 @@ style::TextStyle Preview::scaled(
|
|||
.font = scaled(value.font, fontSize),
|
||||
.linkUnderline = value.linkUnderline,
|
||||
.blockPadding = scaled(value.blockPadding),
|
||||
.blockVerticalSkip = scaled(value.blockVerticalSkip),
|
||||
.blockHeader = scaled(value.blockHeader),
|
||||
.blockHeaderPosition = scaled(value.blockHeaderPosition),
|
||||
.blockOutline = scaled(value.blockOutline),
|
||||
.blockRadius = scaled(value.blockRadius),
|
||||
.preScrollable = value.preScrollable,
|
||||
.lineHeight = scaled(value.lineHeight),
|
||||
};
|
||||
|
|
|
@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "styles/style_statistics.h"
|
||||
|
||||
#include <QtCore/QDateTime>
|
||||
#include <QtCore/QLocale>
|
||||
|
||||
namespace Statistic {
|
||||
namespace {
|
||||
|
|
|
@ -109,29 +109,30 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include <rpl/rpl.h>
|
||||
#include <crl/crl.h>
|
||||
|
||||
#include "base/variant.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/algorithm.h"
|
||||
#include "base/invoke_queued.h"
|
||||
#include "base/basic_types.h"
|
||||
#include "base/flat_set.h"
|
||||
#include "base/flat_map.h"
|
||||
#include "base/invoke_queued.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/variant.h"
|
||||
#include "base/weak_ptr.h"
|
||||
|
||||
#include "base/basic_types.h"
|
||||
#include "logs.h"
|
||||
#include "core/utils.h"
|
||||
#include "config.h"
|
||||
|
||||
#include "scheme.h"
|
||||
#include "mtproto/type_utils.h"
|
||||
|
||||
#include "ui/image/image_location.h"
|
||||
#include "ui/style/style_core.h"
|
||||
#include "ui/text/text.h"
|
||||
#include "ui/arc_angles.h"
|
||||
#include "ui/emoji_config.h"
|
||||
|
||||
#include "styles/palette.h"
|
||||
#include "styles/style_basic.h"
|
||||
|
||||
#include "ui/arc_angles.h"
|
||||
#include "ui/image/image_location.h"
|
||||
#include "ui/text/text.h"
|
||||
#include "core/utils.h"
|
||||
#include "logs.h"
|
||||
#include "config.h"
|
||||
|
||||
#include "data/data_types.h"
|
||||
|
||||
|
|
|
@ -1272,7 +1272,7 @@ void Account::readDraftCursors(PeerId peerId, Data::HistoryDrafts &map) {
|
|||
: keysOld
|
||||
? Data::DraftKey::FromSerializedOld(keyValueOld)
|
||||
: Data::DraftKey::Local(0);
|
||||
qint32 position = 0, anchor = 0, scroll = QFIXED_MAX;
|
||||
qint32 position = 0, anchor = 0, scroll = Ui::kQFixedMax;
|
||||
draft.stream >> position >> anchor >> scroll;
|
||||
if (const auto i = map.find(key); i != end(map)) {
|
||||
i->second->cursor = MessageCursor(position, anchor, scroll);
|
||||
|
@ -1285,8 +1285,8 @@ void Account::readDraftCursorsLegacy(
|
|||
details::FileReadDescriptor &draft,
|
||||
quint64 draftPeerSerialized,
|
||||
Data::HistoryDrafts &map) {
|
||||
qint32 localPosition = 0, localAnchor = 0, localScroll = QFIXED_MAX;
|
||||
qint32 editPosition = 0, editAnchor = 0, editScroll = QFIXED_MAX;
|
||||
qint32 localPosition = 0, localAnchor = 0, localScroll = Ui::kQFixedMax;
|
||||
qint32 editPosition = 0, editAnchor = 0, editScroll = Ui::kQFixedMax;
|
||||
draft.stream >> localPosition >> localAnchor >> localScroll;
|
||||
if (!draft.stream.atEnd()) {
|
||||
draft.stream >> editPosition >> editAnchor >> editScroll;
|
||||
|
|
|
@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/chat/attach/attach_abstract_single_preview.h"
|
||||
#include "ui/chat/attach/attach_controls.h"
|
||||
#include "ui/chat/attach/attach_send_files_way.h"
|
||||
#include "ui/effects/spoiler_mess.h"
|
||||
#include "ui/abstract_button.h"
|
||||
|
||||
namespace style {
|
||||
|
|
|
@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
#include "ui/chat/attach/attach_album_thumbnail.h"
|
||||
#include "ui/chat/attach/attach_prepare.h"
|
||||
#include "ui/effects/spoiler_mess.h"
|
||||
#include "ui/widgets/popup_menu.h"
|
||||
#include "ui/painter.h"
|
||||
#include "lang/lang_keys.h"
|
||||
|
|
|
@ -40,7 +40,15 @@ msgDateDelta: point(2px, 5px);
|
|||
msgDateImgDelta: 4px;
|
||||
msgDateImgPadding: point(8px, 2px);
|
||||
|
||||
messageTextStyle: defaultTextStyle;
|
||||
messageTextStyle: TextStyle(defaultTextStyle) {
|
||||
blockPadding: margins(10px, 4px, 6px, 4px);
|
||||
blockVerticalSkip: 4px;
|
||||
blockHeader: 20px;
|
||||
blockHeaderPosition: point(10px, 2px);
|
||||
blockOutline: 3px;
|
||||
blockRadius: 5px;
|
||||
preScrollable: true;
|
||||
}
|
||||
msgDateTextStyle: defaultTextStyle;
|
||||
serviceTextPalette: TextPalette(defaultTextPalette) {
|
||||
linkFg: msgServiceFg;
|
||||
|
|
|
@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
#include "ui/chat/chat_theme.h"
|
||||
#include "ui/image/image_prepare.h" // ImageRoundRadius
|
||||
#include "ui/color_contrast.h"
|
||||
#include "ui/painter.h"
|
||||
#include "ui/ui_utility.h"
|
||||
#include "styles/style_chat.h"
|
||||
|
@ -28,6 +29,39 @@ void EnsureCorners(
|
|||
}
|
||||
}
|
||||
|
||||
void EnsureBlockquoteCache(
|
||||
std::unique_ptr<Text::BlockPaintCache> &cache,
|
||||
const style::color &color) {
|
||||
if (cache) {
|
||||
return;
|
||||
}
|
||||
cache = std::make_unique<Text::BlockPaintCache>();
|
||||
cache->bg = color->c;
|
||||
cache->bg.setAlphaF(0.12);
|
||||
cache->outline = color->c;
|
||||
cache->outline.setAlphaF(0.9);
|
||||
}
|
||||
|
||||
void EnsurePreCache(
|
||||
std::unique_ptr<Text::BlockPaintCache> &cache,
|
||||
const style::color &color,
|
||||
Fn<std::optional<QColor>()> bgOverride) {
|
||||
if (cache) {
|
||||
return;
|
||||
}
|
||||
cache = std::make_unique<Text::BlockPaintCache>();
|
||||
const auto bg = bgOverride();
|
||||
cache->bg = bg.value_or(color->c);
|
||||
if (!bg) {
|
||||
cache->bg.setAlphaF(0.12);
|
||||
}
|
||||
cache->outline = color->c;
|
||||
cache->outline.setAlphaF(0.9);
|
||||
cache->withHeader = true;
|
||||
cache->header = color->c;
|
||||
cache->header.setAlphaF(0.25);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
not_null<const MessageStyle*> ChatPaintContext::messageStyle() const {
|
||||
|
@ -487,6 +521,8 @@ void ChatStyle::assignPalette(not_null<const style::palette*> palette) {
|
|||
for (auto &style : _messageStyles) {
|
||||
style.msgBgCornersSmall = {};
|
||||
style.msgBgCornersLarge = {};
|
||||
style.blockquoteBlockCache = nullptr;
|
||||
style.preBlockCache = nullptr;
|
||||
}
|
||||
for (auto &style : _imageStyles) {
|
||||
style.msgDateImgBgCorners = {};
|
||||
|
@ -541,6 +577,23 @@ const MessageStyle &ChatStyle::messageStyle(bool outbg, bool selected) const {
|
|||
BubbleRadiusLarge(),
|
||||
result.msgBg,
|
||||
&result.msgShadow);
|
||||
EnsureBlockquoteCache(
|
||||
result.blockquoteBlockCache,
|
||||
result.msgReplyBarColor);
|
||||
|
||||
const auto preBgOverride = [&] {
|
||||
const auto withBg = [&](const QColor &color) {
|
||||
return Ui::CountContrast(windowBg()->c, color);
|
||||
};
|
||||
const auto dark = (withBg({ 0, 0, 0 }) < withBg({ 255, 255, 255 }));
|
||||
return dark ? QColor(0, 0, 0, 192) : std::optional<QColor>();
|
||||
};
|
||||
EnsurePreCache(
|
||||
result.preBlockCache,
|
||||
(selected
|
||||
? result.textPalette.selectMonoFg
|
||||
: result.textPalette.monoFg),
|
||||
preBgOverride);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
@ -76,6 +76,8 @@ struct MessageStyle {
|
|||
style::icon historyPollChoiceRight = { Qt::Uninitialized };
|
||||
style::icon historyTranscribeIcon = { Qt::Uninitialized };
|
||||
style::icon historyTranscribeHide = { Qt::Uninitialized };
|
||||
std::unique_ptr<Text::BlockPaintCache> blockquoteBlockCache;
|
||||
std::unique_ptr<Text::BlockPaintCache> preBlockCache;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "styles/palette.h"
|
||||
|
||||
#include <QtGui/QtEvents>
|
||||
#include <QtCore/QLocale>
|
||||
|
||||
namespace Ui {
|
||||
|
||||
|
|
|
@ -7,8 +7,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
*/
|
||||
#include "ui/chat/message_bar.h"
|
||||
|
||||
#include "ui/text/text_options.h"
|
||||
#include "ui/effects/spoiler_mess.h"
|
||||
#include "ui/image/image_prepare.h"
|
||||
#include "ui/text/text_options.h"
|
||||
#include "ui/painter.h"
|
||||
#include "ui/power_saving.h"
|
||||
#include "styles/style_chat.h"
|
||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/chat/pinned_bar.h"
|
||||
|
||||
#include "ui/chat/message_bar.h"
|
||||
#include "ui/effects/spoiler_mess.h"
|
||||
#include "ui/widgets/shadow.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/wrap/fade_wrap.h"
|
||||
|
|
|
@ -25,6 +25,12 @@ constexpr auto kPlayStatusLimit = 2;
|
|||
|
||||
} // namespace
|
||||
|
||||
struct PeerBadge::EmojiStatus {
|
||||
DocumentId id = 0;
|
||||
std::unique_ptr<Ui::Text::CustomEmoji> emoji;
|
||||
int skip = 0;
|
||||
};
|
||||
|
||||
void UnreadBadge::setText(const QString &text, bool active) {
|
||||
_text = text;
|
||||
_active = active;
|
||||
|
|
|
@ -55,11 +55,7 @@ public:
|
|||
void unload();
|
||||
|
||||
private:
|
||||
struct EmojiStatus {
|
||||
DocumentId id = 0;
|
||||
std::unique_ptr<Ui::Text::CustomEmoji> emoji;
|
||||
int skip = 0;
|
||||
};
|
||||
struct EmojiStatus;
|
||||
std::unique_ptr<EmojiStatus> _emojiStatus;
|
||||
|
||||
};
|
||||
|
|
|
@ -1069,7 +1069,7 @@ void Manager::notificationActivated(
|
|||
MessageCursor{
|
||||
int(reply.text.size()),
|
||||
int(reply.text.size()),
|
||||
QFIXED_MAX,
|
||||
Ui::kQFixedMax,
|
||||
},
|
||||
Data::PreviewState::Allowed);
|
||||
history->setLocalDraft(std::move(draft));
|
||||
|
|
|
@ -1519,7 +1519,11 @@ bool SessionController::switchInlineQuery(
|
|||
'@' + bot->username() + ' ' + query,
|
||||
TextWithTags::Tags(),
|
||||
};
|
||||
MessageCursor cursor = { int(textWithTags.text.size()), int(textWithTags.text.size()), QFIXED_MAX };
|
||||
MessageCursor cursor = {
|
||||
int(textWithTags.text.size()),
|
||||
int(textWithTags.text.size()),
|
||||
Ui::kQFixedMax
|
||||
};
|
||||
auto draft = std::make_unique<Data::Draft>(
|
||||
textWithTags,
|
||||
to.currentReplyToId,
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 44f8d862ff03390217841fb282cb8dd55e0d5d7d
|
||||
Subproject commit a38b60636a42932b5e4d3d2391769a34876a2626
|
Loading…
Add table
Reference in a new issue