mirror of https://github.com/procxx/kepka.git
Various fixes.
Copy inline keyboard when forwarding messages with a game. Don't show "Deleted Message" in service message with scores. Improved tiny web page previews. Ignore right button in emoji panel.
This commit is contained in:
parent
16ce28f4d2
commit
eb47b9468c
|
@ -590,6 +590,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
"lng_action_pinned_media_game" = "the game «{game}»";
|
"lng_action_pinned_media_game" = "the game «{game}»";
|
||||||
"lng_action_game_score" = "{from} scored {count:#|#|#} in {game}";
|
"lng_action_game_score" = "{from} scored {count:#|#|#} in {game}";
|
||||||
"lng_action_game_you_scored" = "You scored {count:#|#|#} in {game}";
|
"lng_action_game_you_scored" = "You scored {count:#|#|#} in {game}";
|
||||||
|
"lng_action_game_score_no_game" = "{from} scored {count:#|#|#}";
|
||||||
|
"lng_action_game_you_scored_no_game" = "You scored {count:#|#|#}";
|
||||||
|
|
||||||
"lng_profile_migrate_reached" = "{count:_not_used_|# member|# members} limit reached";
|
"lng_profile_migrate_reached" = "{count:_not_used_|# member|# members} limit reached";
|
||||||
"lng_profile_migrate_body" = "To get over this limit, you can upgrade your group to a supergroup.";
|
"lng_profile_migrate_body" = "To get over this limit, you can upgrade your group to a supergroup.";
|
||||||
|
|
|
@ -359,7 +359,7 @@ void HistoryMessageReplyMarkup::createFromButtonRows(const QVector<MTPKeyboardBu
|
||||||
if (!b.isEmpty()) {
|
if (!b.isEmpty()) {
|
||||||
ButtonRow buttonRow;
|
ButtonRow buttonRow;
|
||||||
buttonRow.reserve(b.size());
|
buttonRow.reserve(b.size());
|
||||||
for_const (const auto &button, b) {
|
for_const (auto &button, b) {
|
||||||
switch (button.type()) {
|
switch (button.type()) {
|
||||||
case mtpc_keyboardButton: {
|
case mtpc_keyboardButton: {
|
||||||
buttonRow.push_back({ Button::Type::Default, qs(button.c_keyboardButton().vtext), QByteArray(), 0 });
|
buttonRow.push_back({ Button::Type::Default, qs(button.c_keyboardButton().vtext), QByteArray(), 0 });
|
||||||
|
@ -408,31 +408,46 @@ void HistoryMessageReplyMarkup::create(const MTPReplyMarkup &markup) {
|
||||||
|
|
||||||
switch (markup.type()) {
|
switch (markup.type()) {
|
||||||
case mtpc_replyKeyboardMarkup: {
|
case mtpc_replyKeyboardMarkup: {
|
||||||
const auto &d(markup.c_replyKeyboardMarkup());
|
auto &d = markup.c_replyKeyboardMarkup();
|
||||||
flags = d.vflags.v;
|
flags = d.vflags.v;
|
||||||
|
|
||||||
createFromButtonRows(d.vrows.c_vector().v);
|
createFromButtonRows(d.vrows.c_vector().v);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case mtpc_replyInlineMarkup: {
|
case mtpc_replyInlineMarkup: {
|
||||||
const auto &d(markup.c_replyInlineMarkup());
|
auto &d = markup.c_replyInlineMarkup();
|
||||||
flags = MTPDreplyKeyboardMarkup::Flags(0) | MTPDreplyKeyboardMarkup_ClientFlag::f_inline;
|
flags = MTPDreplyKeyboardMarkup::Flags(0) | MTPDreplyKeyboardMarkup_ClientFlag::f_inline;
|
||||||
|
|
||||||
createFromButtonRows(d.vrows.c_vector().v);
|
createFromButtonRows(d.vrows.c_vector().v);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case mtpc_replyKeyboardHide: {
|
case mtpc_replyKeyboardHide: {
|
||||||
const auto &d(markup.c_replyKeyboardHide());
|
auto &d = markup.c_replyKeyboardHide();
|
||||||
flags = mtpCastFlags(d.vflags) | MTPDreplyKeyboardMarkup_ClientFlag::f_zero;
|
flags = mtpCastFlags(d.vflags) | MTPDreplyKeyboardMarkup_ClientFlag::f_zero;
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case mtpc_replyKeyboardForceReply: {
|
case mtpc_replyKeyboardForceReply: {
|
||||||
const auto &d(markup.c_replyKeyboardForceReply());
|
auto &d = markup.c_replyKeyboardForceReply();
|
||||||
flags = mtpCastFlags(d.vflags) | MTPDreplyKeyboardMarkup_ClientFlag::f_force_reply;
|
flags = mtpCastFlags(d.vflags) | MTPDreplyKeyboardMarkup_ClientFlag::f_force_reply;
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HistoryMessageReplyMarkup::create(const HistoryMessageReplyMarkup &markup) {
|
||||||
|
flags = markup.flags;
|
||||||
|
inlineKeyboard = nullptr;
|
||||||
|
|
||||||
|
rows.clear();
|
||||||
|
for_const (auto &row, markup.rows) {
|
||||||
|
ButtonRow buttonRow;
|
||||||
|
buttonRow.reserve(row.size());
|
||||||
|
for_const (auto &button, row) {
|
||||||
|
buttonRow.push_back({ button.type, button.text, button.data, 0 });
|
||||||
|
}
|
||||||
|
if (!buttonRow.isEmpty()) rows.push_back(buttonRow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void HistoryMessageUnreadBar::init(int count) {
|
void HistoryMessageUnreadBar::init(int count) {
|
||||||
if (_freezed) return;
|
if (_freezed) return;
|
||||||
_text = lng_unread_bar(lt_count, count);
|
_text = lng_unread_bar(lt_count, count);
|
||||||
|
|
|
@ -199,6 +199,7 @@ struct HistoryMessageReplyMarkup : public RuntimeComponent<HistoryMessageReplyMa
|
||||||
}
|
}
|
||||||
|
|
||||||
void create(const MTPReplyMarkup &markup);
|
void create(const MTPReplyMarkup &markup);
|
||||||
|
void create(const HistoryMessageReplyMarkup &markup);
|
||||||
|
|
||||||
struct Button {
|
struct Button {
|
||||||
enum class Type {
|
enum class Type {
|
||||||
|
@ -758,13 +759,13 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
PeerData *fromOriginal() const {
|
PeerData *fromOriginal() const {
|
||||||
if (const HistoryMessageForwarded *fwd = Get<HistoryMessageForwarded>()) {
|
if (auto fwd = Get<HistoryMessageForwarded>()) {
|
||||||
return fwd->_fromOriginal;
|
return fwd->_fromOriginal;
|
||||||
}
|
}
|
||||||
return from();
|
return from();
|
||||||
}
|
}
|
||||||
PeerData *authorOriginal() const {
|
PeerData *authorOriginal() const {
|
||||||
if (const HistoryMessageForwarded *fwd = Get<HistoryMessageForwarded>()) {
|
if (auto fwd = Get<HistoryMessageForwarded>()) {
|
||||||
return fwd->_authorOriginal;
|
return fwd->_authorOriginal;
|
||||||
}
|
}
|
||||||
return author();
|
return author();
|
||||||
|
@ -898,6 +899,12 @@ protected:
|
||||||
void recountAttachToPrevious();
|
void recountAttachToPrevious();
|
||||||
|
|
||||||
const HistoryMessageReplyMarkup *inlineReplyMarkup() const {
|
const HistoryMessageReplyMarkup *inlineReplyMarkup() const {
|
||||||
|
return const_cast<HistoryItem*>(this)->inlineReplyMarkup();
|
||||||
|
}
|
||||||
|
const ReplyKeyboard *inlineReplyKeyboard() const {
|
||||||
|
return const_cast<HistoryItem*>(this)->inlineReplyKeyboard();
|
||||||
|
}
|
||||||
|
HistoryMessageReplyMarkup *inlineReplyMarkup() {
|
||||||
if (auto markup = Get<HistoryMessageReplyMarkup>()) {
|
if (auto markup = Get<HistoryMessageReplyMarkup>()) {
|
||||||
if (markup->flags & MTPDreplyKeyboardMarkup_ClientFlag::f_inline) {
|
if (markup->flags & MTPDreplyKeyboardMarkup_ClientFlag::f_inline) {
|
||||||
return markup;
|
return markup;
|
||||||
|
@ -905,18 +912,12 @@ protected:
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
const ReplyKeyboard *inlineReplyKeyboard() const {
|
ReplyKeyboard *inlineReplyKeyboard() {
|
||||||
if (auto markup = inlineReplyMarkup()) {
|
if (auto markup = inlineReplyMarkup()) {
|
||||||
return markup->inlineKeyboard.get();
|
return markup->inlineKeyboard.get();
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
HistoryMessageReplyMarkup *inlineReplyMarkup() {
|
|
||||||
return const_cast<HistoryMessageReplyMarkup*>(static_cast<const HistoryItem*>(this)->inlineReplyMarkup());
|
|
||||||
}
|
|
||||||
ReplyKeyboard *inlineReplyKeyboard() {
|
|
||||||
return const_cast<ReplyKeyboard*>(static_cast<const HistoryItem*>(this)->inlineReplyKeyboard());
|
|
||||||
}
|
|
||||||
|
|
||||||
TextSelection toMediaSelection(TextSelection selection) const {
|
TextSelection toMediaSelection(TextSelection selection) const {
|
||||||
return internal::unshiftSelection(selection, _text);
|
return internal::unshiftSelection(selection, _text);
|
||||||
|
|
|
@ -2562,7 +2562,7 @@ int HistoryWebPage::resizeGetHeight(int width) {
|
||||||
return _height;
|
return _height;
|
||||||
}
|
}
|
||||||
|
|
||||||
_width = width = qMin(width, _maxw);
|
_width = width/* = qMin(width, _maxw)*/;
|
||||||
width -= st::msgPadding.left() + st::webPageLeft + st::msgPadding.right();
|
width -= st::msgPadding.left() + st::webPageLeft + st::msgPadding.right();
|
||||||
|
|
||||||
int32 linesMax = 5;
|
int32 linesMax = 5;
|
||||||
|
@ -2686,9 +2686,9 @@ void HistoryWebPage::draw(Painter &p, const QRect &r, TextSelection selection, u
|
||||||
} else {
|
} else {
|
||||||
pix = _data->photo->thumb->pixBlurredSingle(ImageRoundRadius::Small, pixw, pixh, pw, ph);
|
pix = _data->photo->thumb->pixBlurredSingle(ImageRoundRadius::Small, pixw, pixh, pw, ph);
|
||||||
}
|
}
|
||||||
p.drawPixmapLeft(padding.left() + width - pw, 0, _width, pix);
|
p.drawPixmapLeft(padding.left() + width - pw, tshift, _width, pix);
|
||||||
if (selected) {
|
if (selected) {
|
||||||
App::roundRect(p, rtlrect(padding.left() + width - pw, 0, pw, _pixh, _width), textstyleCurrent()->selectOverlay, SelectedOverlaySmallCorners);
|
App::roundRect(p, rtlrect(padding.left() + width - pw, tshift, pw, _pixh, _width), textstyleCurrent()->selectOverlay, SelectedOverlaySmallCorners);
|
||||||
}
|
}
|
||||||
width -= pw + st::webPagePhotoDelta;
|
width -= pw + st::webPagePhotoDelta;
|
||||||
}
|
}
|
||||||
|
|
|
@ -366,7 +366,7 @@ HistoryMessage::HistoryMessage(History *history, const MTPDmessage &msg)
|
||||||
CreateConfig config;
|
CreateConfig config;
|
||||||
|
|
||||||
if (msg.has_fwd_from() && msg.vfwd_from.type() == mtpc_messageFwdHeader) {
|
if (msg.has_fwd_from() && msg.vfwd_from.type() == mtpc_messageFwdHeader) {
|
||||||
const auto &f(msg.vfwd_from.c_messageFwdHeader());
|
auto &f = msg.vfwd_from.c_messageFwdHeader();
|
||||||
if (f.has_from_id() || f.has_channel_id()) {
|
if (f.has_from_id() || f.has_channel_id()) {
|
||||||
config.authorIdOriginal = f.has_channel_id() ? peerFromChannel(f.vchannel_id) : peerFromUser(f.vfrom_id);
|
config.authorIdOriginal = f.has_channel_id() ? peerFromChannel(f.vchannel_id) : peerFromUser(f.vfrom_id);
|
||||||
config.fromIdOriginal = f.has_from_id() ? peerFromUser(f.vfrom_id) : peerFromChannel(f.vchannel_id);
|
config.fromIdOriginal = f.has_from_id() ? peerFromUser(f.vfrom_id) : peerFromChannel(f.vchannel_id);
|
||||||
|
@ -376,7 +376,7 @@ HistoryMessage::HistoryMessage(History *history, const MTPDmessage &msg)
|
||||||
if (msg.has_reply_to_msg_id()) config.replyTo = msg.vreply_to_msg_id.v;
|
if (msg.has_reply_to_msg_id()) config.replyTo = msg.vreply_to_msg_id.v;
|
||||||
if (msg.has_via_bot_id()) config.viaBotId = msg.vvia_bot_id.v;
|
if (msg.has_via_bot_id()) config.viaBotId = msg.vvia_bot_id.v;
|
||||||
if (msg.has_views()) config.viewsCount = msg.vviews.v;
|
if (msg.has_views()) config.viewsCount = msg.vviews.v;
|
||||||
if (msg.has_reply_markup()) config.markup = &msg.vreply_markup;
|
if (msg.has_reply_markup()) config.mtpMarkup = &msg.vreply_markup;
|
||||||
if (msg.has_edit_date()) config.editDate = ::date(msg.vedit_date);
|
if (msg.has_edit_date()) config.editDate = ::date(msg.vedit_date);
|
||||||
|
|
||||||
createComponents(config);
|
createComponents(config);
|
||||||
|
@ -435,9 +435,15 @@ HistoryMessage::HistoryMessage(History *history, MsgId id, MTPDmessage::Flags fl
|
||||||
config.viewsCount = 1;
|
config.viewsCount = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Copy inline keyboard when forwarding messages with a game.
|
||||||
|
auto mediaOriginal = fwd->getMedia();
|
||||||
|
if (mediaOriginal && mediaOriginal->type() == MediaTypeGame) {
|
||||||
|
config.inlineMarkup = fwd->inlineReplyMarkup();
|
||||||
|
}
|
||||||
|
|
||||||
createComponents(config);
|
createComponents(config);
|
||||||
|
|
||||||
if (HistoryMedia *mediaOriginal = fwd->getMedia()) {
|
if (mediaOriginal) {
|
||||||
_media.reset(mediaOriginal->clone(this));
|
_media.reset(mediaOriginal->clone(this));
|
||||||
}
|
}
|
||||||
setText(fwd->originalText());
|
setText(fwd->originalText());
|
||||||
|
@ -479,7 +485,7 @@ void HistoryMessage::createComponentsHelper(MTPDmessage::Flags flags, MsgId repl
|
||||||
|
|
||||||
if (flags & MTPDmessage::Flag::f_via_bot_id) config.viaBotId = viaBotId;
|
if (flags & MTPDmessage::Flag::f_via_bot_id) config.viaBotId = viaBotId;
|
||||||
if (flags & MTPDmessage::Flag::f_reply_to_msg_id) config.replyTo = replyTo;
|
if (flags & MTPDmessage::Flag::f_reply_to_msg_id) config.replyTo = replyTo;
|
||||||
if (flags & MTPDmessage::Flag::f_reply_markup) config.markup = &markup;
|
if (flags & MTPDmessage::Flag::f_reply_markup) config.mtpMarkup = &markup;
|
||||||
if (isPost()) config.viewsCount = 1;
|
if (isPost()) config.viewsCount = 1;
|
||||||
|
|
||||||
createComponents(config);
|
createComponents(config);
|
||||||
|
@ -518,8 +524,10 @@ void HistoryMessage::updateMediaInBubbleState() {
|
||||||
_media->setInBubbleState(computeState());
|
_media->setInBubbleState(computeState());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HistoryMessage::displayEditedBadge(bool hasViaBot) const {
|
bool HistoryMessage::displayEditedBadge(bool hasViaBotOrInlineMarkup) const {
|
||||||
if (!(_flags & MTPDmessage::Flag::f_edit_date)) {
|
if (hasViaBotOrInlineMarkup) {
|
||||||
|
return false;
|
||||||
|
} else if (!(_flags & MTPDmessage::Flag::f_edit_date)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (auto fromUser = from()->asUser()) {
|
if (auto fromUser = from()->asUser()) {
|
||||||
|
@ -527,9 +535,6 @@ bool HistoryMessage::displayEditedBadge(bool hasViaBot) const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hasViaBot) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -548,20 +553,31 @@ void HistoryMessage::createComponents(const CreateConfig &config) {
|
||||||
if (isPost() && _from->isUser()) {
|
if (isPost() && _from->isUser()) {
|
||||||
mask |= HistoryMessageSigned::Bit();
|
mask |= HistoryMessageSigned::Bit();
|
||||||
}
|
}
|
||||||
if (displayEditedBadge(config.viaBotId != 0)) {
|
auto hasViaBot = (config.viaBotId != 0);
|
||||||
|
auto hasInlineMarkup = [&config] {
|
||||||
|
if (config.mtpMarkup) {
|
||||||
|
return (config.mtpMarkup->type() == mtpc_replyInlineMarkup);
|
||||||
|
}
|
||||||
|
return (config.inlineMarkup != nullptr);
|
||||||
|
};
|
||||||
|
if (displayEditedBadge(hasViaBot || hasInlineMarkup())) {
|
||||||
mask |= HistoryMessageEdited::Bit();
|
mask |= HistoryMessageEdited::Bit();
|
||||||
}
|
}
|
||||||
if (config.authorIdOriginal && config.fromIdOriginal) {
|
if (config.authorIdOriginal && config.fromIdOriginal) {
|
||||||
mask |= HistoryMessageForwarded::Bit();
|
mask |= HistoryMessageForwarded::Bit();
|
||||||
}
|
}
|
||||||
if (config.markup) {
|
if (config.mtpMarkup) {
|
||||||
// optimization: don't create markup component for the case
|
// optimization: don't create markup component for the case
|
||||||
// MTPDreplyKeyboardHide with flags = 0, assume it has f_zero flag
|
// MTPDreplyKeyboardHide with flags = 0, assume it has f_zero flag
|
||||||
if (config.markup->type() != mtpc_replyKeyboardHide || config.markup->c_replyKeyboardHide().vflags.v != 0) {
|
if (config.mtpMarkup->type() != mtpc_replyKeyboardHide || config.mtpMarkup->c_replyKeyboardHide().vflags.v != 0) {
|
||||||
mask |= HistoryMessageReplyMarkup::Bit();
|
mask |= HistoryMessageReplyMarkup::Bit();
|
||||||
}
|
}
|
||||||
|
} else if (config.inlineMarkup) {
|
||||||
|
mask |= HistoryMessageReplyMarkup::Bit();
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateComponents(mask);
|
UpdateComponents(mask);
|
||||||
|
|
||||||
if (auto reply = Get<HistoryMessageReply>()) {
|
if (auto reply = Get<HistoryMessageReply>()) {
|
||||||
reply->replyToMsgId = config.replyTo;
|
reply->replyToMsgId = config.replyTo;
|
||||||
if (!reply->updateData(this) && App::api()) {
|
if (!reply->updateData(this) && App::api()) {
|
||||||
|
@ -586,7 +602,11 @@ void HistoryMessage::createComponents(const CreateConfig &config) {
|
||||||
fwd->_originalId = config.originalId;
|
fwd->_originalId = config.originalId;
|
||||||
}
|
}
|
||||||
if (auto markup = Get<HistoryMessageReplyMarkup>()) {
|
if (auto markup = Get<HistoryMessageReplyMarkup>()) {
|
||||||
markup->create(*config.markup);
|
if (config.mtpMarkup) {
|
||||||
|
markup->create(*config.mtpMarkup);
|
||||||
|
} else if (config.inlineMarkup) {
|
||||||
|
markup->create(*config.inlineMarkup);
|
||||||
|
}
|
||||||
if (markup->flags & MTPDreplyKeyboardMarkup_ClientFlag::f_has_switch_inline_button) {
|
if (markup->flags & MTPDreplyKeyboardMarkup_ClientFlag::f_has_switch_inline_button) {
|
||||||
_flags |= MTPDmessage_ClientFlag::f_has_switch_inline_button;
|
_flags |= MTPDmessage_ClientFlag::f_has_switch_inline_button;
|
||||||
}
|
}
|
||||||
|
@ -829,7 +849,9 @@ void HistoryMessage::applyEdition(const MTPDmessage &message) {
|
||||||
|
|
||||||
if (message.has_edit_date()) {
|
if (message.has_edit_date()) {
|
||||||
_flags |= MTPDmessage::Flag::f_edit_date;
|
_flags |= MTPDmessage::Flag::f_edit_date;
|
||||||
if (displayEditedBadge(Has<HistoryMessageVia>())) {
|
auto hasViaBotId = Has<HistoryMessageVia>();
|
||||||
|
auto hasInlineMarkup = (inlineReplyMarkup() != nullptr);
|
||||||
|
if (displayEditedBadge(hasViaBotId || hasInlineMarkup)) {
|
||||||
if (!Has<HistoryMessageEdited>()) {
|
if (!Has<HistoryMessageEdited>()) {
|
||||||
AddComponents(HistoryMessageEdited::Bit());
|
AddComponents(HistoryMessageEdited::Bit());
|
||||||
}
|
}
|
||||||
|
@ -2009,14 +2031,22 @@ bool HistoryService::prepareGameScoreText(const QString &from, QString *outText,
|
||||||
gameTitle = lang(lng_contacts_loading);
|
gameTitle = lang(lng_contacts_loading);
|
||||||
result = true;
|
result = true;
|
||||||
} else {
|
} else {
|
||||||
gameTitle = lang(lng_deleted_message);
|
gameTitle = QString();
|
||||||
}
|
}
|
||||||
auto scoreNumber = gamescore ? gamescore->score : 0;
|
auto scoreNumber = gamescore ? gamescore->score : 0;
|
||||||
if (_from->isSelf()) {
|
if (_from->isSelf()) {
|
||||||
|
if (gameTitle.isEmpty()) {
|
||||||
|
*outText = lng_action_game_you_scored_no_game(lt_count, scoreNumber);
|
||||||
|
} else {
|
||||||
*outText = lng_action_game_you_scored(lt_count, scoreNumber, lt_game, gameTitle);
|
*outText = lng_action_game_you_scored(lt_count, scoreNumber, lt_game, gameTitle);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (gameTitle.isEmpty()) {
|
||||||
|
*outText = lng_action_game_score_no_game(lt_from, from, lt_count, scoreNumber);
|
||||||
} else {
|
} else {
|
||||||
*outText = lng_action_game_score(lt_from, from, lt_count, scoreNumber, lt_game, gameTitle);
|
*outText = lng_action_game_score(lt_from, from, lt_count, scoreNumber, lt_game, gameTitle);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (second) {
|
if (second) {
|
||||||
outLinks->push_back(second);
|
outLinks->push_back(second);
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ public:
|
||||||
|
|
||||||
return (!emptyText() || !_media || !_media->isDisplayed() || Has<HistoryMessageReply>() || Has<HistoryMessageForwarded>() || viaBot() || !_media->hideFromName());
|
return (!emptyText() || !_media || !_media->isDisplayed() || Has<HistoryMessageReply>() || Has<HistoryMessageForwarded>() || viaBot() || !_media->hideFromName());
|
||||||
}
|
}
|
||||||
bool displayEditedBadge(bool hasViaBot) const;
|
bool displayEditedBadge(bool hasViaBotOrInlineMarkup) const;
|
||||||
bool uploading() const {
|
bool uploading() const {
|
||||||
return _media && _media->uploading();
|
return _media && _media->uploading();
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,12 @@ private:
|
||||||
PeerId fromIdOriginal = 0;
|
PeerId fromIdOriginal = 0;
|
||||||
MsgId originalId = 0;
|
MsgId originalId = 0;
|
||||||
QDateTime editDate;
|
QDateTime editDate;
|
||||||
const MTPReplyMarkup *markup = nullptr;
|
|
||||||
|
// For messages created from MTP structs.
|
||||||
|
const MTPReplyMarkup *mtpMarkup = nullptr;
|
||||||
|
|
||||||
|
// For messages created from existing messages (forwarded).
|
||||||
|
const HistoryMessageReplyMarkup *inlineMarkup = nullptr;
|
||||||
};
|
};
|
||||||
void createComponentsHelper(MTPDmessage::Flags flags, MsgId replyTo, int32 viaBotId, const MTPReplyMarkup &markup);
|
void createComponentsHelper(MTPDmessage::Flags flags, MsgId replyTo, int32 viaBotId, const MTPReplyMarkup &markup);
|
||||||
void createComponents(const CreateConfig &config);
|
void createComponents(const CreateConfig &config);
|
||||||
|
|
|
@ -31,6 +31,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "lang.h"
|
#include "lang.h"
|
||||||
|
#include "application.h"
|
||||||
#include "playerwidget.h"
|
#include "playerwidget.h"
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
|
|
||||||
|
@ -1078,6 +1079,9 @@ bool _readSetting(quint32 blockId, QDataStream &stream, int version) {
|
||||||
if (!_checkStreamStatus(stream)) return false;
|
if (!_checkStreamStatus(stream)) return false;
|
||||||
|
|
||||||
cSetAutoUpdate(v == 1);
|
cSetAutoUpdate(v == 1);
|
||||||
|
if (!cAutoUpdate()) {
|
||||||
|
Sandbox::stopUpdate();
|
||||||
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case dbiLastUpdateCheck: {
|
case dbiLastUpdateCheck: {
|
||||||
|
|
|
@ -193,6 +193,9 @@ void GeneralWidget::refreshControls() {
|
||||||
style::margins marginLink(st::defaultBoxCheckbox.textPosition.x(), 0, 0, st::settingsSkip);
|
style::margins marginLink(st::defaultBoxCheckbox.textPosition.x(), 0, 0, st::settingsSkip);
|
||||||
addChildRow(_updateRow, marginLink, slidedPadding);
|
addChildRow(_updateRow, marginLink, slidedPadding);
|
||||||
connect(_updateRow->entity(), SIGNAL(restart()), this, SLOT(onRestart()));
|
connect(_updateRow->entity(), SIGNAL(restart()), this, SLOT(onRestart()));
|
||||||
|
if (!cAutoUpdate()) {
|
||||||
|
_updateRow->hideFast();
|
||||||
|
}
|
||||||
#endif // TDESKTOP_DISABLE_AUTOUPDATE
|
#endif // TDESKTOP_DISABLE_AUTOUPDATE
|
||||||
|
|
||||||
if (cPlatform() == dbipWindows || cSupportTray()) {
|
if (cPlatform() == dbipWindows || cSupportTray()) {
|
||||||
|
|
|
@ -116,6 +116,9 @@ void EmojiColorPicker::leaveEvent(QEvent *e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmojiColorPicker::mousePressEvent(QMouseEvent *e) {
|
void EmojiColorPicker::mousePressEvent(QMouseEvent *e) {
|
||||||
|
if (e->button() != Qt::LeftButton) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
_lastMousePos = e->globalPos();
|
_lastMousePos = e->globalPos();
|
||||||
updateSelected();
|
updateSelected();
|
||||||
_pressedSel = _selected;
|
_pressedSel = _selected;
|
||||||
|
@ -411,7 +414,7 @@ bool EmojiPanInner::checkPickerHide() {
|
||||||
void EmojiPanInner::mousePressEvent(QMouseEvent *e) {
|
void EmojiPanInner::mousePressEvent(QMouseEvent *e) {
|
||||||
_lastMousePos = e->globalPos();
|
_lastMousePos = e->globalPos();
|
||||||
updateSelected();
|
updateSelected();
|
||||||
if (checkPickerHide()) {
|
if (checkPickerHide() || e->button() != Qt::LeftButton) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_pressedSel = _selected;
|
_pressedSel = _selected;
|
||||||
|
@ -1160,6 +1163,9 @@ QRect StickerPanInner::featuredAddRect(int index) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void StickerPanInner::mousePressEvent(QMouseEvent *e) {
|
void StickerPanInner::mousePressEvent(QMouseEvent *e) {
|
||||||
|
if (e->button() != Qt::LeftButton) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
_lastMousePos = e->globalPos();
|
_lastMousePos = e->globalPos();
|
||||||
updateSelected();
|
updateSelected();
|
||||||
|
|
||||||
|
@ -2895,7 +2901,7 @@ void EmojiPan::otherLeave() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmojiPan::mousePressEvent(QMouseEvent *e) {
|
void EmojiPan::mousePressEvent(QMouseEvent *e) {
|
||||||
if (!_stickersShown) return;
|
if (!_stickersShown || e->button() != Qt::LeftButton) return;
|
||||||
_iconsMousePos = e ? e->globalPos() : QCursor::pos();
|
_iconsMousePos = e ? e->globalPos() : QCursor::pos();
|
||||||
updateSelected();
|
updateSelected();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue