mirror of https://github.com/procxx/kepka.git
Not inline bot keyboard now supports editing as well.
Styles improved for not inline bot keyboard. Full crash string adding to crash report. Preparing to leave source code without #include "stdafx.h"
This commit is contained in:
parent
0e0956451a
commit
1ef944ed7b
|
@ -2114,17 +2114,17 @@ verifiedCheckInv: sprite(299px, 221px, 14px, 14px);
|
||||||
verifiedCheckPos: point(4px, 2px);
|
verifiedCheckPos: point(4px, 2px);
|
||||||
|
|
||||||
botKbDuration: 200;
|
botKbDuration: 200;
|
||||||
botKbBg: #f7f7f7;
|
botKbBg: #edf1f5;
|
||||||
botKbOverBg: #e8ecef;
|
botKbOverBg: #d8e2ec;
|
||||||
botKbDownBg: #dfe3e6;
|
botKbDownBg: #d8e2ec;
|
||||||
botKbColor: #8a8a8f;
|
botKbColor: #4b565f;
|
||||||
botKbFont: font(16px);
|
botKbFont: font(15px semibold);
|
||||||
botKbButton: botKeyboardButton {
|
botKbButton: botKeyboardButton {
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
height: 36px;
|
height: 38px;
|
||||||
textTop: 8px;
|
textTop: 9px;
|
||||||
downTextTop: 9px;
|
downTextTop: 10px;
|
||||||
}
|
}
|
||||||
botKbTinyButton: botKeyboardButton {
|
botKbTinyButton: botKeyboardButton {
|
||||||
margin: 4px;
|
margin: 4px;
|
||||||
|
|
|
@ -244,6 +244,12 @@ namespace Notify {
|
||||||
if (MainWidget *m = App::main()) m->notify_inlineBotRequesting(requesting);
|
if (MainWidget *m = App::main()) m->notify_inlineBotRequesting(requesting);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void replyMarkupUpdated(const HistoryItem *item) {
|
||||||
|
if (MainWidget *m = App::main()) {
|
||||||
|
m->notify_replyMarkupUpdated(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void migrateUpdated(PeerData *peer) {
|
void migrateUpdated(PeerData *peer) {
|
||||||
if (MainWidget *m = App::main()) m->notify_migrateUpdated(peer);
|
if (MainWidget *m = App::main()) m->notify_migrateUpdated(peer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,6 +94,7 @@ namespace Notify {
|
||||||
void botCommandsChanged(UserData *user);
|
void botCommandsChanged(UserData *user);
|
||||||
|
|
||||||
void inlineBotRequesting(bool requesting);
|
void inlineBotRequesting(bool requesting);
|
||||||
|
void replyMarkupUpdated(const HistoryItem *item);
|
||||||
|
|
||||||
void migrateUpdated(PeerData *peer);
|
void migrateUpdated(PeerData *peer);
|
||||||
|
|
||||||
|
|
|
@ -3574,7 +3574,7 @@ TextBlock::TextBlock(const style::font &font, const QString &str, QFixed minResi
|
||||||
|
|
||||||
bool logCrashString = (rand_value<uchar>() % 4 == 1);
|
bool logCrashString = (rand_value<uchar>() % 4 == 1);
|
||||||
if (logCrashString) {
|
if (logCrashString) {
|
||||||
SignalHandlers::setCrashAnnotationRef("CrashString", &part);
|
SignalHandlers::setCrashAnnotationRef("CrashString", &str);
|
||||||
}
|
}
|
||||||
BlockParser parser(&engine, this, minResizeWidth, _from, part);
|
BlockParser parser(&engine, this, minResizeWidth, _from, part);
|
||||||
if (logCrashString) {
|
if (logCrashString) {
|
||||||
|
|
|
@ -3533,7 +3533,6 @@ HistoryPhoto::HistoryPhoto(PhotoData *photo, const QString &caption, const Histo
|
||||||
, _data(photo)
|
, _data(photo)
|
||||||
, _caption(st::minPhotoSize - st::msgPadding.left() - st::msgPadding.right()) {
|
, _caption(st::minPhotoSize - st::msgPadding.left() - st::msgPadding.right()) {
|
||||||
setLinks(MakeShared<PhotoOpenClickHandler>(_data), MakeShared<PhotoSaveClickHandler>(_data), MakeShared<PhotoCancelClickHandler>(_data));
|
setLinks(MakeShared<PhotoOpenClickHandler>(_data), MakeShared<PhotoSaveClickHandler>(_data), MakeShared<PhotoCancelClickHandler>(_data));
|
||||||
|
|
||||||
if (!caption.isEmpty()) {
|
if (!caption.isEmpty()) {
|
||||||
_caption.setText(st::msgFont, caption + parent->skipBlock(), itemTextNoMonoOptions(parent));
|
_caption.setText(st::msgFont, caption + parent->skipBlock(), itemTextNoMonoOptions(parent));
|
||||||
}
|
}
|
||||||
|
@ -7058,6 +7057,8 @@ void HistoryMessage::setReplyMarkup(const MTPReplyMarkup *markup) {
|
||||||
if (Has<HistoryMessageReplyMarkup>()) {
|
if (Has<HistoryMessageReplyMarkup>()) {
|
||||||
RemoveComponents(HistoryMessageReplyMarkup::Bit());
|
RemoveComponents(HistoryMessageReplyMarkup::Bit());
|
||||||
setPendingInitDimensions();
|
setPendingInitDimensions();
|
||||||
|
|
||||||
|
Notify::replyMarkupUpdated(this);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!Has<HistoryMessageReplyMarkup>()) {
|
if (!Has<HistoryMessageReplyMarkup>()) {
|
||||||
|
@ -7065,6 +7066,8 @@ void HistoryMessage::setReplyMarkup(const MTPReplyMarkup *markup) {
|
||||||
}
|
}
|
||||||
Get<HistoryMessageReplyMarkup>()->create(*markup);
|
Get<HistoryMessageReplyMarkup>()->create(*markup);
|
||||||
setPendingInitDimensions();
|
setPendingInitDimensions();
|
||||||
|
|
||||||
|
Notify::replyMarkupUpdated(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1510,7 +1510,7 @@ public:
|
||||||
}
|
}
|
||||||
virtual void applyEdition(const MTPDmessage &message) {
|
virtual void applyEdition(const MTPDmessage &message) {
|
||||||
}
|
}
|
||||||
virtual void updateMedia(const MTPMessageMedia *media, bool edited = false) {
|
virtual void updateMedia(const MTPMessageMedia *media) {
|
||||||
}
|
}
|
||||||
virtual int32 addToOverview(AddToOverviewMethod method) {
|
virtual int32 addToOverview(AddToOverviewMethod method) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2835,8 +2835,8 @@ public:
|
||||||
QString notificationText() const override;
|
QString notificationText() const override;
|
||||||
|
|
||||||
void applyEdition(const MTPDmessage &message) override;
|
void applyEdition(const MTPDmessage &message) override;
|
||||||
void updateMedia(const MTPMessageMedia *media, bool edited = false) override {
|
void updateMedia(const MTPMessageMedia *media) override {
|
||||||
if (!edited && media && _media && _media->type() != MediaTypeWebPage) {
|
if (media && _media && _media->type() != MediaTypeWebPage) {
|
||||||
_media->updateFrom(*media, this);
|
_media->updateFrom(*media, this);
|
||||||
} else {
|
} else {
|
||||||
setMedia(media);
|
setMedia(media);
|
||||||
|
|
|
@ -2136,8 +2136,8 @@ void ReportSpamPanel::setReported(bool reported, PeerData *onPeer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
BotKeyboard::BotKeyboard() {
|
BotKeyboard::BotKeyboard() {
|
||||||
setGeometry(0, 0, _st->margin, _st->margin);
|
setGeometry(0, 0, _st->margin, st::botKbScroll.deltat);
|
||||||
_height = _st->margin;
|
_height = st::botKbScroll.deltat;
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2149,8 +2149,8 @@ void BotKeyboard::paintEvent(QPaintEvent *e) {
|
||||||
|
|
||||||
if (_impl) {
|
if (_impl) {
|
||||||
int x = rtl() ? st::botKbScroll.width : _st->margin;
|
int x = rtl() ? st::botKbScroll.width : _st->margin;
|
||||||
p.translate(x, _st->margin);
|
p.translate(x, st::botKbScroll.deltat);
|
||||||
_impl->paint(p, clip.translated(-x, -_st->margin));
|
_impl->paint(p, clip.translated(-x, -st::botKbScroll.deltat));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2195,14 +2195,14 @@ void BotKeyboard::resizeEvent(QResizeEvent *e) {
|
||||||
|
|
||||||
updateStyle();
|
updateStyle();
|
||||||
|
|
||||||
_height = _impl->naturalHeight() + 2 * _st->margin;
|
_height = _impl->naturalHeight() + st::botKbScroll.deltat + st::botKbScroll.deltab;
|
||||||
if (_maximizeSize) _height = qMax(_height, _maxOuterHeight);
|
if (_maximizeSize) _height = qMax(_height, _maxOuterHeight);
|
||||||
if (height() != _height) {
|
if (height() != _height) {
|
||||||
resize(width(), _height);
|
resize(width(), _height);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_impl->resize(width() - _st->margin - st::botKbScroll.width, _height - 2 * _st->margin);
|
_impl->resize(width() - _st->margin - st::botKbScroll.width, _height - (st::botKbScroll.deltat + st::botKbScroll.deltab));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BotKeyboard::mousePressEvent(QMouseEvent *e) {
|
void BotKeyboard::mousePressEvent(QMouseEvent *e) {
|
||||||
|
@ -2246,9 +2246,11 @@ void BotKeyboard::clickHandlerPressedChanged(const ClickHandlerPtr &p, bool pres
|
||||||
_impl->clickHandlerPressedChanged(p, pressed);
|
_impl->clickHandlerPressedChanged(p, pressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BotKeyboard::updateMarkup(HistoryItem *to) {
|
bool BotKeyboard::updateMarkup(HistoryItem *to, bool force) {
|
||||||
if (to && to->definesReplyKeyboard()) {
|
if (to && to->definesReplyKeyboard()) {
|
||||||
if (_wasForMsgId == FullMsgId(to->channelId(), to->id)) return false;
|
if (_wasForMsgId == FullMsgId(to->channelId(), to->id) && !force) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
_wasForMsgId = FullMsgId(to->channelId(), to->id);
|
_wasForMsgId = FullMsgId(to->channelId(), to->id);
|
||||||
clearSelection();
|
clearSelection();
|
||||||
|
@ -2261,7 +2263,7 @@ bool BotKeyboard::updateMarkup(HistoryItem *to) {
|
||||||
_impl.reset(markup->rows.isEmpty() ? nullptr : new ReplyKeyboard(to, MakeUnique<Style>(this, *_st)));
|
_impl.reset(markup->rows.isEmpty() ? nullptr : new ReplyKeyboard(to, MakeUnique<Style>(this, *_st)));
|
||||||
|
|
||||||
updateStyle();
|
updateStyle();
|
||||||
_height = 2 * _st->margin + (_impl ? _impl->naturalHeight() : 0);
|
_height = st::botKbScroll.deltat + st::botKbScroll.deltab + (_impl ? _impl->naturalHeight() : 0);
|
||||||
if (_maximizeSize) _height = qMax(_height, _maxOuterHeight);
|
if (_maximizeSize) _height = qMax(_height, _maxOuterHeight);
|
||||||
if (height() != _height) {
|
if (height() != _height) {
|
||||||
resize(width(), _height);
|
resize(width(), _height);
|
||||||
|
@ -2290,7 +2292,7 @@ bool BotKeyboard::forceReply() const {
|
||||||
|
|
||||||
void BotKeyboard::resizeToWidth(int width, int maxOuterHeight) {
|
void BotKeyboard::resizeToWidth(int width, int maxOuterHeight) {
|
||||||
updateStyle(width);
|
updateStyle(width);
|
||||||
_height = 2 * _st->margin + (_impl ? _impl->naturalHeight() : 0);
|
_height = st::botKbScroll.deltat + st::botKbScroll.deltab + (_impl ? _impl->naturalHeight() : 0);
|
||||||
_maxOuterHeight = maxOuterHeight;
|
_maxOuterHeight = maxOuterHeight;
|
||||||
|
|
||||||
if (_maximizeSize) _height = qMax(_height, _maxOuterHeight);
|
if (_maximizeSize) _height = qMax(_height, _maxOuterHeight);
|
||||||
|
@ -3172,6 +3174,12 @@ void HistoryWidget::notify_inlineBotRequesting(bool requesting) {
|
||||||
_attachEmoji.setLoading(requesting);
|
_attachEmoji.setLoading(requesting);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HistoryWidget::notify_replyMarkupUpdated(const HistoryItem *item) {
|
||||||
|
if (_keyboard.forMsgId() == item->fullId()) {
|
||||||
|
updateBotKeyboard(item->history(), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void HistoryWidget::notify_userIsBotChanged(UserData *user) {
|
void HistoryWidget::notify_userIsBotChanged(UserData *user) {
|
||||||
if (_peer && _peer == user) {
|
if (_peer && _peer == user) {
|
||||||
_list->notifyIsBotChanged();
|
_list->notifyIsBotChanged();
|
||||||
|
@ -6540,7 +6548,7 @@ void HistoryWidget::countHistoryShowFrom() {
|
||||||
_history->updateShowFrom();
|
_history->updateShowFrom();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::updateBotKeyboard(History *h) {
|
void HistoryWidget::updateBotKeyboard(History *h, bool force) {
|
||||||
if (h && h != _history && h != _migrated) {
|
if (h && h != _history && h != _migrated) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -6548,11 +6556,12 @@ void HistoryWidget::updateBotKeyboard(History *h) {
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
bool wasVisible = _kbShown || _kbReplyTo;
|
bool wasVisible = _kbShown || _kbReplyTo;
|
||||||
if ((_replyToId && !_replyEditMsg) || _editMsgId || !_history) {
|
if ((_replyToId && !_replyEditMsg) || _editMsgId || !_history) {
|
||||||
changed = _keyboard.updateMarkup(0);
|
changed = _keyboard.updateMarkup(nullptr, force);
|
||||||
} else if (_replyToId && _replyEditMsg) {
|
} else if (_replyToId && _replyEditMsg) {
|
||||||
changed = _keyboard.updateMarkup(_replyEditMsg);
|
changed = _keyboard.updateMarkup(_replyEditMsg, force);
|
||||||
} else {
|
} else {
|
||||||
changed = _keyboard.updateMarkup(_history->lastKeyboardId ? App::histItemById(_channel, _history->lastKeyboardId) : 0);
|
HistoryItem *keyboardItem = _history->lastKeyboardId ? App::histItemById(_channel, _history->lastKeyboardId) : nullptr;
|
||||||
|
changed = _keyboard.updateMarkup(keyboardItem, force);
|
||||||
}
|
}
|
||||||
updateCmdStartShown();
|
updateCmdStartShown();
|
||||||
if (!changed) return;
|
if (!changed) return;
|
||||||
|
|
|
@ -314,7 +314,9 @@ public:
|
||||||
void enterEvent(QEvent *e);
|
void enterEvent(QEvent *e);
|
||||||
void leaveEvent(QEvent *e);
|
void leaveEvent(QEvent *e);
|
||||||
|
|
||||||
bool updateMarkup(HistoryItem *last);
|
// With force=true the markup is updated even if it is
|
||||||
|
// already shown for the passed history item.
|
||||||
|
bool updateMarkup(HistoryItem *last, bool force = false);
|
||||||
bool hasMarkup() const;
|
bool hasMarkup() const;
|
||||||
bool forceReply() const;
|
bool forceReply() const;
|
||||||
|
|
||||||
|
@ -608,7 +610,10 @@ public:
|
||||||
bool insertBotCommand(const QString &cmd, bool specialGif);
|
bool insertBotCommand(const QString &cmd, bool specialGif);
|
||||||
|
|
||||||
bool eventFilter(QObject *obj, QEvent *e) override;
|
bool eventFilter(QObject *obj, QEvent *e) override;
|
||||||
void updateBotKeyboard(History *h = 0);
|
|
||||||
|
// With force=true the markup is updated even if it is
|
||||||
|
// already shown for the passed history item.
|
||||||
|
void updateBotKeyboard(History *h = nullptr, bool force = false);
|
||||||
|
|
||||||
DragState getDragState(const QMimeData *d);
|
DragState getDragState(const QMimeData *d);
|
||||||
|
|
||||||
|
@ -656,6 +661,7 @@ public:
|
||||||
void notify_historyItemLayoutChanged(const HistoryItem *item);
|
void notify_historyItemLayoutChanged(const HistoryItem *item);
|
||||||
void notify_botCommandsChanged(UserData *user);
|
void notify_botCommandsChanged(UserData *user);
|
||||||
void notify_inlineBotRequesting(bool requesting);
|
void notify_inlineBotRequesting(bool requesting);
|
||||||
|
void notify_replyMarkupUpdated(const HistoryItem *item);
|
||||||
void notify_userIsBotChanged(UserData *user);
|
void notify_userIsBotChanged(UserData *user);
|
||||||
void notify_migrateUpdated(PeerData *peer);
|
void notify_migrateUpdated(PeerData *peer);
|
||||||
void notify_clipStopperHidden(ClipStopperType type);
|
void notify_clipStopperHidden(ClipStopperType type);
|
||||||
|
|
|
@ -770,6 +770,10 @@ void MainWidget::notify_inlineBotRequesting(bool requesting) {
|
||||||
history.notify_inlineBotRequesting(requesting);
|
history.notify_inlineBotRequesting(requesting);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWidget::notify_replyMarkupUpdated(const HistoryItem *item) {
|
||||||
|
history.notify_replyMarkupUpdated(item);
|
||||||
|
}
|
||||||
|
|
||||||
void MainWidget::notify_userIsBotChanged(UserData *bot) {
|
void MainWidget::notify_userIsBotChanged(UserData *bot) {
|
||||||
history.notify_userIsBotChanged(bot);
|
history.notify_userIsBotChanged(bot);
|
||||||
}
|
}
|
||||||
|
|
|
@ -443,6 +443,7 @@ public:
|
||||||
|
|
||||||
void notify_botCommandsChanged(UserData *bot);
|
void notify_botCommandsChanged(UserData *bot);
|
||||||
void notify_inlineBotRequesting(bool requesting);
|
void notify_inlineBotRequesting(bool requesting);
|
||||||
|
void notify_replyMarkupUpdated(const HistoryItem *item);
|
||||||
void notify_userIsBotChanged(UserData *bot);
|
void notify_userIsBotChanged(UserData *bot);
|
||||||
void notify_userIsContactChanged(UserData *user, bool fromThisApp);
|
void notify_userIsContactChanged(UserData *user, bool fromThisApp);
|
||||||
void notify_migrateUpdated(PeerData *peer);
|
void notify_migrateUpdated(PeerData *peer);
|
||||||
|
|
|
@ -205,7 +205,7 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : TWidget(parent)
|
||||||
, _showSessions(this, lang(lng_settings_show_sessions))
|
, _showSessions(this, lang(lng_settings_show_sessions))
|
||||||
, _askQuestion(this, lang(lng_settings_ask_question))
|
, _askQuestion(this, lang(lng_settings_ask_question))
|
||||||
, _telegramFAQ(this, lang(lng_settings_faq))
|
, _telegramFAQ(this, lang(lng_settings_faq))
|
||||||
, _logOut(this, lang(lng_settings_logout), st::btnLogout)
|
, _logOut(this, lang(lng_settings_logout), st::btnRedLink)
|
||||||
, _supportGetRequest(0) {
|
, _supportGetRequest(0) {
|
||||||
if (self()) {
|
if (self()) {
|
||||||
self()->loadUserpic();
|
self()->loadUserpic();
|
||||||
|
|
|
@ -294,8 +294,7 @@ private:
|
||||||
LinkButton _connectionType;
|
LinkButton _connectionType;
|
||||||
QString _connectionTypeText;
|
QString _connectionTypeText;
|
||||||
int32 _connectionTypeWidth;
|
int32 _connectionTypeWidth;
|
||||||
LinkButton _showSessions, _askQuestion, _telegramFAQ;
|
LinkButton _showSessions, _askQuestion, _telegramFAQ, _logOut;
|
||||||
FlatButton _logOut;
|
|
||||||
|
|
||||||
mtpRequestId _supportGetRequest;
|
mtpRequestId _supportGetRequest;
|
||||||
|
|
||||||
|
|
|
@ -79,6 +79,7 @@
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<AdditionalOptions>/Zm152 %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>/Zm152 %(AdditionalOptions)</AdditionalOptions>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<ForcedIncludeFiles>"stdafx.h"</ForcedIncludeFiles>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
|
@ -109,6 +110,7 @@
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||||
<AdditionalOptions>/Zm110 %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>/Zm110 %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
<ForcedIncludeFiles>"stdafx.h"</ForcedIncludeFiles>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
|
@ -140,6 +142,7 @@
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||||
<AdditionalOptions>/Zm110 %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>/Zm110 %(AdditionalOptions)</AdditionalOptions>
|
||||||
|
<ForcedIncludeFiles>"stdafx.h"</ForcedIncludeFiles>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
|
|
Loading…
Reference in New Issue