2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

fixed shared memory locations, scheme updated

This commit is contained in:
John Preston
2015-12-29 20:54:34 +08:00
parent 820339d390
commit cdcd9d8d54
15 changed files with 976 additions and 366 deletions

View File

@@ -2727,7 +2727,8 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent)
_saveDraftTimer.setSingleShot(true);
connect(&_saveDraftTimer, SIGNAL(timeout()), this, SLOT(onDraftSave()));
connect(_field.verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(onDraftSaveDelayed()));
connect(&_field, SIGNAL(cursorPositionChanged()), this, SLOT(onFieldCursorChanged()));
connect(&_field, SIGNAL(cursorPositionChanged()), this, SLOT(onDraftSaveDelayed()));
connect(&_field, SIGNAL(cursorPositionChanged()), this, SLOT(onCheckMentionDropdown()), Qt::QueuedConnection);
_replyForwardPreviewCancel.hide();
@@ -3020,7 +3021,7 @@ void HistoryWidget::updateStickers() {
void HistoryWidget::notify_botCommandsChanged(UserData *user) {
if (_peer && (_peer == user || !_peer->isUser())) {
if (_attachMention.clearFilteredCommands()) {
checkMentionDropdown();
onCheckMentionDropdown();
}
}
}
@@ -3728,7 +3729,7 @@ void HistoryWidget::updateControlsVisibility() {
update();
}
} else if (_canSendMessages) {
checkMentionDropdown();
onCheckMentionDropdown();
if (isBotStart()) {
if (isBotStart()) {
_unblock.hide();
@@ -4479,7 +4480,7 @@ void HistoryWidget::shareContact(const PeerId &peer, const QString &phone, const
} else {
flags |= MTPDmessage::flag_from_id;
}
h->addNewMessage(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(fromChannelName ? 0 : MTP::authedId()), peerToMTP(peer), MTPPeer(), MTPint(), MTP_int(replyToId()), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaContact(MTP_string(phone), MTP_string(fname), MTP_string(lname), MTP_int(userId)), MTPnullMarkup, MTPnullEntities, MTP_int(1)), NewMessageUnread);
h->addNewMessage(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(fromChannelName ? 0 : MTP::authedId()), peerToMTP(peer), MTPPeer(), MTPint(), MTPint(), MTP_int(replyToId()), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaContact(MTP_string(phone), MTP_string(fname), MTP_string(lname), MTP_int(userId)), MTPnullMarkup, MTPnullEntities, MTP_int(1)), NewMessageUnread);
h->sendRequestId = MTP::send(MTPmessages_SendMedia(MTP_int(sendFlags), p->input, MTP_int(replyTo), MTP_inputMediaContact(MTP_string(phone), MTP_string(fname), MTP_string(lname)), MTP_long(randomId), MTPnullMarkup), App::main()->rpcDone(&MainWidget::sentUpdatesReceived), App::main()->rpcFail(&MainWidget::sendMessageFail), 0, 0, h->sendRequestId);
App::historyRegRandom(randomId, newId);
@@ -4959,13 +4960,13 @@ void HistoryWidget::contextBotResolveDone(const MTPcontacts_ResolvedPeer &result
_contextBot = App::user(peerId);
}
}
checkMentionDropdown();
onCheckMentionDropdown();
}
bool HistoryWidget::contextBotResolveFail(const RPCError &error) {
if (mtpIsFlood(error)) return false;
_contextBot = 0;
checkMentionDropdown();
onCheckMentionDropdown();
return true;
}
@@ -5307,7 +5308,7 @@ void HistoryWidget::onFieldFocused() {
if (_list) _list->clearSelectedItems(true);
}
void HistoryWidget::checkMentionDropdown() {
void HistoryWidget::onCheckMentionDropdown() {
if (!_history || _a_show.animating()) return;
QString start, contextBotUsername(_contextBotUsername);
@@ -5337,11 +5338,6 @@ void HistoryWidget::checkMentionDropdown() {
}
}
void HistoryWidget::onFieldCursorChanged() {
checkMentionDropdown();
onDraftSaveDelayed();
}
void HistoryWidget::uploadImage(const QImage &img, PrepareMediaType type, FileLoadForceConfirmType confirm, const QString &source, bool withText) {
if (!_history) return;
@@ -5433,14 +5429,14 @@ void HistoryWidget::confirmSendFile(const FileLoadResultPtr &file, bool ctrlShif
flags |= MTPDmessage::flag_from_id;
}
if (file->type == PreparePhoto) {
h->addNewMessage(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(fromChannelName ? 0 : MTP::authedId()), peerToMTP(file->to.peer), MTPPeer(), MTPint(), MTP_int(file->to.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaPhoto(file->photo, MTP_string(file->caption)), MTPnullMarkup, MTPnullEntities, MTP_int(1)), NewMessageUnread);
h->addNewMessage(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(fromChannelName ? 0 : MTP::authedId()), peerToMTP(file->to.peer), MTPPeer(), MTPint(), MTPint(), MTP_int(file->to.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaPhoto(file->photo, MTP_string(file->caption)), MTPnullMarkup, MTPnullEntities, MTP_int(1)), NewMessageUnread);
} else if (file->type == PrepareDocument) {
h->addNewMessage(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(fromChannelName ? 0 : MTP::authedId()), peerToMTP(file->to.peer), MTPPeer(), MTPint(), MTP_int(file->to.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaDocument(file->document, MTP_string(file->caption)), MTPnullMarkup, MTPnullEntities, MTP_int(1)), NewMessageUnread);
h->addNewMessage(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(fromChannelName ? 0 : MTP::authedId()), peerToMTP(file->to.peer), MTPPeer(), MTPint(), MTPint(), MTP_int(file->to.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaDocument(file->document, MTP_string(file->caption)), MTPnullMarkup, MTPnullEntities, MTP_int(1)), NewMessageUnread);
} else if (file->type == PrepareAudio) {
if (!h->peer->isChannel()) {
flags |= MTPDmessage::flag_media_unread;
}
h->addNewMessage(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(fromChannelName ? 0 : MTP::authedId()), peerToMTP(file->to.peer), MTPPeer(), MTPint(), MTP_int(file->to.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaAudio(file->audio), MTPnullMarkup, MTPnullEntities, MTP_int(1)), NewMessageUnread);
h->addNewMessage(MTP_message(MTP_int(flags), MTP_int(newId.msg), MTP_int(fromChannelName ? 0 : MTP::authedId()), peerToMTP(file->to.peer), MTPPeer(), MTPint(), MTPint(), MTP_int(file->to.replyTo), MTP_int(unixtime()), MTP_string(""), MTP_messageMediaAudio(file->audio), MTPnullMarkup, MTPnullEntities, MTP_int(1)), NewMessageUnread);
}
if (_peer && file->to.peer == _peer->id) {
@@ -6553,7 +6549,7 @@ void HistoryWidget::onFullPeerUpdated(PeerData *data) {
}
updateControlsVisibility();
}
checkMentionDropdown();
onCheckMentionDropdown();
updateReportSpamStatus();
int32 lh = _list->height(), st = _scroll.scrollTop();
_list->updateBotInfo();