Alpha version 0.10.22: critical bug fixes.

This commit is contained in:
John Preston 2016-12-31 17:34:41 +04:00
parent bc0c355d2d
commit 218f991547
42 changed files with 634 additions and 212 deletions

View File

@ -34,8 +34,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,10,21,0
PRODUCTVERSION 0,10,21,0
FILEVERSION 0,10,22,0
PRODUCTVERSION 0,10,22,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -51,10 +51,10 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Telegram Messenger LLP"
VALUE "FileVersion", "0.10.21.0"
VALUE "FileVersion", "0.10.22.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2016"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "0.10.21.0"
VALUE "ProductVersion", "0.10.22.0"
END
END
BLOCK "VarFileInfo"

View File

@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,10,21,0
PRODUCTVERSION 0,10,21,0
FILEVERSION 0,10,22,0
PRODUCTVERSION 0,10,22,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -43,10 +43,10 @@ BEGIN
BEGIN
VALUE "CompanyName", "Telegram Messenger LLP"
VALUE "FileDescription", "Telegram Updater"
VALUE "FileVersion", "0.10.21.0"
VALUE "FileVersion", "0.10.22.0"
VALUE "LegalCopyright", "Copyright (C) 2014-2016"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "0.10.21.0"
VALUE "ProductVersion", "0.10.22.0"
END
END
BLOCK "VarFileInfo"

View File

@ -65,8 +65,7 @@ BackgroundBox::Inner::Inner(QWidget *parent) : TWidget(parent)
}
subscribe(FileDownload::ImageLoaded(), [this] { update(); });
using Update = Window::Theme::BackgroundUpdate;
subscribe(Window::Theme::Background(), [this](const Update &update) {
subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) {
if (update.paletteChanged()) {
_check->invalidateCache();
}

View File

@ -447,11 +447,12 @@ void RichDeleteMessageBox::deleteAndClear() {
App::main()->deleteAllFromUser(_channel, _from);
}
if (auto item = App::histItemById(_channel ? peerToChannel(_channel->id) : 0, _msgId)) {
bool wasLast = (item->history()->lastMsg == item);
auto wasLast = (item->history()->lastMsg == item);
item->destroy();
if (_msgId > 0) {
App::main()->deleteMessages(_channel, QVector<MTPint>(1, MTP_int(_msgId)));
auto forEveryone = true;
App::main()->deleteMessages(_channel, QVector<MTPint>(1, MTP_int(_msgId)), forEveryone);
} else if (wasLast) {
App::main()->checkPeerHistory(_channel);
}

View File

@ -638,8 +638,7 @@ void ContactsBox::Inner::init() {
connect(App::main(), SIGNAL(peerNameChanged(PeerData*,const PeerData::Names&,const PeerData::NameFirstChars&)), this, SLOT(onPeerNameChanged(PeerData*,const PeerData::Names&,const PeerData::NameFirstChars&)));
connect(App::main(), SIGNAL(peerPhotoChanged(PeerData*)), this, SLOT(peerUpdated(PeerData*)));
using Update = Window::Theme::BackgroundUpdate;
subscribe(Window::Theme::Background(), [this](const Update &update) {
subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) {
if (update.paletteChanged()) {
invalidateCache();
}

View File

@ -296,8 +296,7 @@ ShareBox::Inner::Inner(QWidget *parent, ShareBox::FilterCallback &&filterCallbac
}));
subscribe(FileDownload::ImageLoaded(), [this] { update(); });
using Update = Window::Theme::BackgroundUpdate;
subscribe(Window::Theme::Background(), [this](const Update &update) {
subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) {
if (update.paletteChanged()) {
invalidateCache();
}

View File

@ -276,6 +276,7 @@ void StickersBox::prepare() {
if (_tabs) {
_tabs->raise();
_unreadBadge->raise();
}
rebuildList();
}
@ -402,6 +403,7 @@ void StickersBox::switchTab() {
_section = newSection;
setInnerWidget(_tab->takeWidget(), getTopSkip());
_tabs->raise();
_unreadBadge->raise();
_tab->widget()->show();
rebuildList();
onScrollToY(_tab->getScrollTop());

View File

@ -24,7 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#define BETA_VERSION_MACRO (0ULL)
constexpr int AppVersion = 10021;
constexpr str_const AppVersionStr = "0.10.21";
constexpr int AppVersion = 10022;
constexpr str_const AppVersionStr = "0.10.22";
constexpr bool AppAlphaVersion = true;
constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO;

View File

@ -336,5 +336,18 @@ void paintImportantSwitch(Painter &p, Mode current, int fullWidth, bool selected
}
}
void clearUnreadBadgesCache() {
if (unreadBadgeStyle) {
for (auto &data : unreadBadgeStyle->sizes) {
for (auto &left : data.left) {
left = QPixmap();
}
for (auto &right : data.right) {
right = QPixmap();
}
}
}
}
} // namespace Layout
} // namespace Dialogs

View File

@ -62,5 +62,7 @@ struct UnreadBadgeStyle {
};
void paintUnreadCount(Painter &p, const QString &text, int x, int y, const UnreadBadgeStyle &st, int *outUnreadWidth = nullptr);
void clearUnreadBadgesCache();
} // namespace Layout
} // namespace Dialogs

View File

@ -42,6 +42,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "apiwrap.h"
#include "ui/widgets/dropdown_menu.h"
#include "ui/widgets/input_fields.h"
#include "window/window_theme.h"
#include "autoupdater.h"
namespace {
@ -94,6 +95,12 @@ DialogsInner::DialogsInner(QWidget *parent, QWidget *main) : SplittedWidget(pare
updateDialogRow(update.history->peer, MsgId(0), updateRect, UpdateRowSection::Default | UpdateRowSection::Filtered);
});
subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &data) {
if (data.paletteChanged()) {
Dialogs::Layout::clearUnreadBadgesCache();
}
});
refresh();
}

View File

@ -1887,6 +1887,23 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
prepareGameScoreText(from, &text, &links);
} break;
case mtpc_messageActionPhoneCall: {
auto &d = action.c_messageActionPhoneCall();
if (d.has_reason()) {
switch (d.vreason.type()) {
case mtpc_phoneCallDiscardReasonBusy: break;
case mtpc_phoneCallDiscardReasonDisconnect: break;
case mtpc_phoneCallDiscardReasonHangup: break;
case mtpc_phoneCallDiscardReasonMissed: break;
}
} else {
}
if (d.has_duration()) {
d.vduration.v;
}
} break;
default: from = QString(); break;
}

View File

@ -1265,7 +1265,9 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
if (isUponSelected > 1) {
_menu->addAction(lang(lng_context_forward_selected), _widget, SLOT(onForwardSelected()));
if (selectedForDelete == selectedForForward) {
_menu->addAction(lang(lng_context_delete_selected), _widget, SLOT(onDeleteSelected()));
_menu->addAction(lang(lng_context_delete_selected), base::lambda_guarded(this, [this] {
_widget->confirmDeleteSelectedItems();
}));
}
_menu->addAction(lang(lng_context_clear_selection), _widget, SLOT(onClearSelected()));
} else if (App::hoveredLinkItem()) {
@ -1274,7 +1276,9 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
_menu->addAction(lang(lng_context_forward_msg), _widget, SLOT(forwardMessage()))->setEnabled(true);
}
if (App::hoveredLinkItem()->canDelete()) {
_menu->addAction(lang(lng_context_delete_msg), _widget, SLOT(deleteMessage()))->setEnabled(true);
_menu->addAction(lang(lng_context_delete_msg), base::lambda_guarded(this, [this] {
_widget->confirmDeleteContextItem();
}));
}
}
if (App::hoveredLinkItem()->id > 0 && !App::hoveredLinkItem()->serviceMsg()) {
@ -1364,7 +1368,9 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
if (isUponSelected > 1) {
_menu->addAction(lang(lng_context_forward_selected), _widget, SLOT(onForwardSelected()));
if (selectedForDelete == selectedForForward) {
_menu->addAction(lang(lng_context_delete_selected), _widget, SLOT(onDeleteSelected()));
_menu->addAction(lang(lng_context_delete_selected), base::lambda_guarded(this, [this] {
_widget->confirmDeleteSelectedItems();
}));
}
_menu->addAction(lang(lng_context_clear_selection), _widget, SLOT(onClearSelected()));
} else if (item && ((isUponSelected != -2 && (canForward || canDelete)) || item->id > 0)) {
@ -1374,7 +1380,9 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
}
if (canDelete) {
_menu->addAction(lang((msg && msg->uploading()) ? lng_context_cancel_upload : lng_context_delete_msg), _widget, SLOT(deleteMessage()))->setEnabled(true);
_menu->addAction(lang((msg && msg->uploading()) ? lng_context_cancel_upload : lng_context_delete_msg), base::lambda_guarded(this, [this] {
_widget->confirmDeleteContextItem();
}));
}
}
if (item->id > 0 && !item->serviceMsg()) {
@ -1558,7 +1566,7 @@ void HistoryInner::keyPressEvent(QKeyEvent *e) {
int32 selectedForForward, selectedForDelete;
getSelectionState(selectedForForward, selectedForDelete);
if (!_selected.isEmpty() && selectedForDelete == selectedForForward) {
_widget->onDeleteSelected();
_widget->confirmDeleteSelectedItems();
}
} else {
e->ignore();
@ -6146,14 +6154,6 @@ void HistoryWidget::contextMenuEvent(QContextMenuEvent *e) {
return _list->showContextMenu(e);
}
void HistoryWidget::deleteMessage() {
HistoryItem *item = App::contextItem();
if (!item || item->type() != HistoryItemMsg) return;
HistoryMessage *msg = dynamic_cast<HistoryMessage*>(item);
App::main()->deleteLayer((msg && msg->uploading()) ? -2 : -1);
}
void HistoryWidget::forwardMessage() {
HistoryItem *item = App::contextItem();
if (!item || item->type() != HistoryItemMsg || item->serviceMsg()) return;
@ -8348,60 +8348,69 @@ void HistoryWidget::onForwardSelected() {
App::main()->forwardLayer(true);
}
void HistoryWidget::onDeleteSelected() {
if (!_list) return;
void HistoryWidget::confirmDeleteContextItem() {
auto item = App::contextItem();
if (!item || item->type() != HistoryItemMsg) return;
SelectedItemSet sel;
_list->fillSelectedItems(sel);
if (sel.isEmpty()) return;
App::main()->deleteLayer(sel.size());
auto message = item->toHistoryMessage();
App::main()->deleteLayer((message && message->uploading()) ? -2 : -1);
}
void HistoryWidget::onDeleteSelectedSure() {
Ui::hideLayer();
void HistoryWidget::confirmDeleteSelectedItems() {
if (!_list) return;
SelectedItemSet sel;
_list->fillSelectedItems(sel);
if (sel.isEmpty()) return;
SelectedItemSet selected;
_list->fillSelectedItems(selected);
if (selected.isEmpty()) return;
QMap<PeerData*, QVector<MTPint> > ids;
for (SelectedItemSet::const_iterator i = sel.cbegin(), e = sel.cend(); i != e; ++i) {
if (i.value()->id > 0) {
ids[i.value()->history()->peer].push_back(MTP_int(i.value()->id));
}
}
onClearSelected();
for (SelectedItemSet::const_iterator i = sel.cbegin(), e = sel.cend(); i != e; ++i) {
i.value()->destroy();
}
for (QMap<PeerData*, QVector<MTPint> >::const_iterator i = ids.cbegin(), e = ids.cend(); i != e; ++i) {
App::main()->deleteMessages(i.key(), i.value());
}
App::main()->deleteLayer(selected.size());
}
void HistoryWidget::onDeleteContextSure() {
void HistoryWidget::deleteContextItem(bool forEveryone) {
Ui::hideLayer();
HistoryItem *item = App::contextItem();
auto item = App::contextItem();
if (!item || item->type() != HistoryItemMsg) {
return;
}
QVector<MTPint> toDelete(1, MTP_int(item->id));
History *h = item->history();
bool wasOnServer = (item->id > 0), wasLast = (h->lastMsg == item);
auto toDelete = QVector<MTPint>(1, MTP_int(item->id));
auto history = item->history();
auto wasOnServer = (item->id > 0);
auto wasLast = (history->lastMsg == item);
item->destroy();
if (!wasOnServer && wasLast && !h->lastMsg) {
App::main()->checkPeerHistory(h->peer);
if (!wasOnServer && wasLast && !history->lastMsg) {
App::main()->checkPeerHistory(history->peer);
}
if (wasOnServer) {
App::main()->deleteMessages(h->peer, toDelete);
App::main()->deleteMessages(history->peer, toDelete, forEveryone);
}
}
void HistoryWidget::deleteSelectedItems(bool forEveryone) {
Ui::hideLayer();
if (!_list) return;
SelectedItemSet selected;
_list->fillSelectedItems(selected);
if (selected.isEmpty()) return;
QMap<PeerData*, QVector<MTPint>> idsByPeer;
for_const (auto item, selected) {
if (item->id > 0) {
idsByPeer[item->history()->peer].push_back(MTP_int(item->id));
}
}
onClearSelected();
for_const (auto item, selected) {
item->destroy();
}
for (auto i = idsByPeer.cbegin(), e = idsByPeer.cend(); i != e; ++i) {
App::main()->deleteMessages(i.key(), i.value(), forEveryone);
}
}

View File

@ -698,6 +698,11 @@ public:
bool isItemVisible(HistoryItem *item);
void confirmDeleteContextItem();
void confirmDeleteSelectedItems();
void deleteContextItem(bool forEveryone);
void deleteSelectedItems(bool forEveryone);
void app_sendBotCallback(const HistoryMessageReplyMarkup::Button *button, const HistoryItem *msg, int row, int col);
void ui_repaintHistoryItem(const HistoryItem *item);
@ -797,7 +802,6 @@ public slots:
void onWindowVisibleChanged();
void deleteMessage();
void forwardMessage();
void selectMessage();
@ -807,9 +811,6 @@ public slots:
void onScrollTimer();
void onForwardSelected();
void onDeleteSelected();
void onDeleteSelectedSure();
void onDeleteContextSure();
void onClearSelected();
void onAnimActiveStep();

View File

@ -655,13 +655,13 @@ void MainWidget::hiderLayer(object_ptr<HistoryHider> h) {
}
}
void MainWidget::forwardLayer(int32 forwardSelected) {
void MainWidget::forwardLayer(int forwardSelected) {
hiderLayer((forwardSelected < 0) ? object_ptr<HistoryHider>(this) : object_ptr<HistoryHider>(this, forwardSelected > 0));
}
void MainWidget::deleteLayer(int32 selectedCount) {
void MainWidget::deleteLayer(int selectedCount) {
if (selectedCount == -1 && !_overview) {
if (HistoryItem *item = App::contextItem()) {
if (auto item = App::contextItem()) {
if (item->suggestBanReportDeleteAll()) {
Ui::show(Box<RichDeleteMessageBox>(item->history()->peer->asChannel(), item->from()->asUser(), item->id));
return;
@ -679,18 +679,18 @@ void MainWidget::deleteLayer(int32 selectedCount) {
Ui::show(Box<ConfirmBox>(text, confirmText, cancelText, base::lambda_guarded(this, [this, selectedCount] {
if (selectedCount < 0) {
if (_overview) {
_overview->onDeleteContextSure();
_overview->deleteContextItem(false);
} else {
_history->onDeleteContextSure();
_history->deleteContextItem(false);
}
if (selectedCount < -1) {
App::uploader()->unpause();
}
} else {
if (_overview) {
_overview->onDeleteSelectedSure();
_overview->deleteSelectedItems(false);
} else {
_history->onDeleteSelectedSure();
_history->deleteSelectedItems(false);
}
}
}), base::lambda_guarded(this, [selectedCount] {
@ -813,11 +813,15 @@ void MainWidget::deleteHistoryPart(DeleteHistoryRequest request, const MTPmessag
MTP::send(MTPmessages_DeleteHistory(MTP_flags(flags), peer->input, MTP_int(0)), rpcDone(&MainWidget::deleteHistoryPart, request));
}
void MainWidget::deleteMessages(PeerData *peer, const QVector<MTPint> &ids) {
void MainWidget::deleteMessages(PeerData *peer, const QVector<MTPint> &ids, bool forEveryone) {
if (peer->isChannel()) {
MTP::send(MTPchannels_DeleteMessages(peer->asChannel()->inputChannel, MTP_vector<MTPint>(ids)), rpcDone(&MainWidget::messagesAffected, peer));
} else {
MTP::send(MTPmessages_DeleteMessages(MTP_vector<MTPint>(ids)), rpcDone(&MainWidget::messagesAffected, peer));
auto flags = MTPmessages_DeleteMessages::Flags(0);
if (forEveryone) {
flags |= MTPmessages_DeleteMessages::Flag::f_revoke;
}
MTP::send(MTPmessages_DeleteMessages(MTP_flags(flags), MTP_vector<MTPint>(ids)), rpcDone(&MainWidget::messagesAffected, peer));
}
}
@ -1104,11 +1108,11 @@ void MainWidget::forwardSelectedItems() {
}
}
void MainWidget::deleteSelectedItems() {
void MainWidget::confirmDeleteSelectedItems() {
if (_overview) {
_overview->onDeleteSelected();
_overview->confirmDeleteSelectedItems();
} else {
_history->onDeleteSelected();
_history->confirmDeleteSelectedItems();
}
}

View File

@ -227,8 +227,8 @@ public:
int32 dlgsWidth() const;
void forwardLayer(int32 forwardSelected = 0); // -1 - send paths
void deleteLayer(int32 selectedCount = -1); // -1 - context item, else selected, -2 - cancel upload
void forwardLayer(int forwardSelected = 0); // -1 - send paths
void deleteLayer(int selectedCount = -1); // -1 - context item, else selected, -2 - cancel upload
void shareContactLayer(UserData *contact);
void shareUrlLayer(const QString &url, const QString &text);
void inlineSwitchLayer(const QString &botAndQuery);
@ -251,7 +251,7 @@ public:
bool leaveChatFailed(PeerData *peer, const RPCError &e);
void deleteHistoryAfterLeave(PeerData *peer, const MTPUpdates &updates);
void deleteMessages(PeerData *peer, const QVector<MTPint> &ids);
void deleteMessages(PeerData *peer, const QVector<MTPint> &ids, bool forEveryone);
void deletedContact(UserData *user, const MTPcontacts_Link &result);
void deleteConversation(PeerData *peer, bool deleteHistory = true);
void deleteAndExit(ChatData *chat);
@ -271,7 +271,7 @@ public:
bool sendMessageFail(const RPCError &error);
void forwardSelectedItems();
void deleteSelectedItems();
void confirmDeleteSelectedItems();
void clearSelectedItems();
Dialogs::IndexedList *contactsList();

View File

@ -212,6 +212,7 @@ QWidget *MainWindow::filedialogParent() {
}
void MainWindow::clearWidgets() {
auto wasMain = (_main != nullptr);
Ui::hideLayer(true);
_passcode.destroyDelayed();
_main.destroy();
@ -220,7 +221,9 @@ void MainWindow::clearWidgets() {
hideMediaview();
_mediaView->rpcClear();
}
App::clearHistories();
if (wasMain) {
App::clearHistories();
}
updateGlobalMenu();
}

View File

@ -197,7 +197,7 @@ bool MediaView::fileShown() const {
}
bool MediaView::fileBubbleShown() const {
return _doc && !fileShown() && !_themePreviewShown;
return (!_photo && !_doc) || (_doc && !fileShown() && !_themePreviewShown);
}
bool MediaView::gifShown() const {
@ -226,7 +226,7 @@ void MediaView::stopGif() {
}
void MediaView::documentUpdated(DocumentData *doc) {
if (fileBubbleShown() && _doc == doc) {
if (fileBubbleShown() && _doc && _doc == doc) {
if ((_doc->loading() && _docCancel->isHidden()) || (!_doc->loading() && !_docCancel->isHidden())) {
updateControls();
} else if (_doc->loading()) {
@ -244,7 +244,7 @@ void MediaView::changingMsgId(HistoryItem *row, MsgId newId) {
}
void MediaView::updateDocSize() {
if (!fileBubbleShown()) return;
if (!_doc || !fileBubbleShown()) return;
if (_doc->loading()) {
quint64 ready = _doc->loadOffset(), total = _doc->size;
@ -277,7 +277,7 @@ void MediaView::updateDocSize() {
}
void MediaView::updateControls() {
if (fileBubbleShown()) {
if (_doc && fileBubbleShown()) {
if (_doc->loading()) {
_docDownload->hide();
_docSaveAs->hide();
@ -2144,7 +2144,7 @@ bool MediaView::moveToNext(int32 delta) {
case MediaTypeSticker: displayDocument(media->getDocument(), item); preloadData(delta); break;
}
} else {
displayDocument(0, item);
displayDocument(nullptr, item);
preloadData(delta);
}
}

View File

@ -253,6 +253,7 @@ messageActionChannelMigrateFrom#b055eaee title:string chat_id:int = MessageActio
messageActionPinMessage#94bd38ed = MessageAction;
messageActionHistoryClear#9fbab604 = MessageAction;
messageActionGameScore#92a72876 game_id:long score:int = MessageAction;
messageActionPhoneCall#80e11a7f flags:# call_id:long reason:flags.0?PhoneCallDiscardReason duration:flags.1?int = MessageAction;
dialog#66ffba14 flags:# pinned:flags.2?true peer:Peer top_message:int read_inbox_max_id:int read_outbox_max_id:int unread_count:int notify_settings:PeerNotifySettings pts:flags.0?int draft:flags.1?DraftMessage = Dialog;
@ -345,6 +346,7 @@ inputMessagesFilterGif#ffc86587 = MessagesFilter;
inputMessagesFilterVoice#50f5c392 = MessagesFilter;
inputMessagesFilterMusic#3751b49e = MessagesFilter;
inputMessagesFilterChatPhotos#3a20ecb8 = MessagesFilter;
inputMessagesFilterPhoneCalls#80c99768 flags:# missed:flags.0?true = MessagesFilter;
updateNewMessage#1f2b0afd message:Message pts:int pts_count:int = Update;
updateMessageID#4e90bfd6 id:int random_id:long = Update;
@ -875,7 +877,7 @@ messages.getHistory#afa92846 peer:InputPeer offset_id:int offset_date:int add_of
messages.search#d4569248 flags:# peer:InputPeer q:string filter:MessagesFilter min_date:int max_date:int offset:int max_id:int limit:int = messages.Messages;
messages.readHistory#e306d3a peer:InputPeer max_id:int = messages.AffectedMessages;
messages.deleteHistory#1c015b09 flags:# just_clear:flags.0?true peer:InputPeer max_id:int = messages.AffectedHistory;
messages.deleteMessages#a5f18925 id:Vector<int> = messages.AffectedMessages;
messages.deleteMessages#e58e95d2 flags:# revoke:flags.0?true id:Vector<int> = messages.AffectedMessages;
messages.receivedMessages#5a954c0 max_id:int = Vector<ReceivedNotifyMessage>;
messages.setTyping#a3825e50 peer:InputPeer action:SendMessageAction = Bool;
messages.sendMessage#fa88427a flags:# no_webpage:flags.1?true silent:flags.5?true background:flags.6?true clear_draft:flags.7?true peer:InputPeer reply_to_msg_id:flags.0?int message:string random_id:long reply_markup:flags.2?ReplyMarkup entities:flags.3?Vector<MessageEntity> = Updates;
@ -902,6 +904,7 @@ messages.sendEncrypted#a9776773 peer:InputEncryptedChat random_id:long data:byte
messages.sendEncryptedFile#9a901b66 peer:InputEncryptedChat random_id:long data:bytes file:InputEncryptedFile = messages.SentEncryptedMessage;
messages.sendEncryptedService#32d439a4 peer:InputEncryptedChat random_id:long data:bytes = messages.SentEncryptedMessage;
messages.receivedQueue#55a5bb66 max_qts:int = Vector<long>;
messages.reportEncryptedSpam#4b0c8c0f peer:InputEncryptedChat = Bool;
messages.readMessageContents#36a73f77 id:Vector<int> = messages.AffectedMessages;
messages.getAllStickers#1c9618b1 hash:int = messages.AllStickers;
messages.getWebPagePreview#25223e24 message:string = MessageMedia;
@ -1008,4 +1011,4 @@ phone.acceptCall#220f0b20 peer:InputPhoneCall g_b:bytes key_fingerprint:long pro
phone.discardCall#5dfbcddc peer:InputPhoneCall duration:int reason:PhoneCallDiscardReason connection_id:long = Bool;
phone.receivedCall#17d54f61 peer:InputPhoneCall = Bool;
// LAYER 61
// LAYER 62

View File

@ -1703,6 +1703,24 @@ void _serialize_messageActionGameScore(MTPStringLogger &to, int32 stage, int32 l
}
}
void _serialize_messageActionPhoneCall(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) {
MTPDmessageActionPhoneCall::Flags flag(iflag);
if (stage) {
to.add(",\n").addSpaces(lev);
} else {
to.add("{ messageActionPhoneCall");
to.add("\n").addSpaces(lev);
}
switch (stage) {
case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 1: to.add(" call_id: "); ++stages.back(); types.push_back(mtpc_long+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 2: to.add(" reason: "); ++stages.back(); if (flag & MTPDmessageActionPhoneCall::Flag::f_reason) { types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break;
case 3: to.add(" duration: "); ++stages.back(); if (flag & MTPDmessageActionPhoneCall::Flag::f_duration) { types.push_back(mtpc_int+0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); } else { to.add("[ SKIPPED BY BIT 1 IN FIELD flags ]"); } break;
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
}
}
void _serialize_dialog(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) {
MTPDdialog::Flags flag(iflag);
@ -2385,6 +2403,22 @@ void _serialize_inputMessagesFilterChatPhotos(MTPStringLogger &to, int32 stage,
to.add("{ inputMessagesFilterChatPhotos }"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back();
}
void _serialize_inputMessagesFilterPhoneCalls(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) {
MTPDinputMessagesFilterPhoneCalls::Flags flag(iflag);
if (stage) {
to.add(",\n").addSpaces(lev);
} else {
to.add("{ inputMessagesFilterPhoneCalls");
to.add("\n").addSpaces(lev);
}
switch (stage) {
case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 1: to.add(" missed: "); ++stages.back(); if (flag & MTPDinputMessagesFilterPhoneCalls::Flag::f_missed) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break;
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
}
}
void _serialize_updateNewMessage(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) {
if (stage) {
to.add(",\n").addSpaces(lev);
@ -7346,6 +7380,19 @@ void _serialize_messages_readEncryptedHistory(MTPStringLogger &to, int32 stage,
}
}
void _serialize_messages_reportEncryptedSpam(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) {
if (stage) {
to.add(",\n").addSpaces(lev);
} else {
to.add("{ messages_reportEncryptedSpam");
to.add("\n").addSpaces(lev);
}
switch (stage) {
case 0: to.add(" peer: "); ++stages.back(); types.push_back(0); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
}
}
void _serialize_messages_uninstallStickerSet(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) {
if (stage) {
to.add(",\n").addSpaces(lev);
@ -8407,6 +8454,8 @@ void _serialize_messages_readHistory(MTPStringLogger &to, int32 stage, int32 lev
}
void _serialize_messages_deleteMessages(MTPStringLogger &to, int32 stage, int32 lev, Types &types, Types &vtypes, StagesFlags &stages, StagesFlags &flags, const mtpPrime *start, const mtpPrime *end, int32 iflag) {
MTPmessages_deleteMessages::Flags flag(iflag);
if (stage) {
to.add(",\n").addSpaces(lev);
} else {
@ -8414,7 +8463,9 @@ void _serialize_messages_deleteMessages(MTPStringLogger &to, int32 stage, int32
to.add("\n").addSpaces(lev);
}
switch (stage) {
case 0: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int+0); stages.push_back(0); flags.push_back(0); break;
case 0: to.add(" flags: "); ++stages.back(); if (start >= end) throw Exception("start >= end in flags"); else flags.back() = *start; types.push_back(mtpc_flags); vtypes.push_back(0); stages.push_back(0); flags.push_back(0); break;
case 1: to.add(" revoke: "); ++stages.back(); if (flag & MTPmessages_deleteMessages::Flag::f_revoke) { to.add("YES [ BY BIT 0 IN FIELD flags ]"); } else { to.add("[ SKIPPED BY BIT 0 IN FIELD flags ]"); } break;
case 2: to.add(" id: "); ++stages.back(); types.push_back(0); vtypes.push_back(mtpc_int+0); stages.push_back(0); flags.push_back(0); break;
default: to.add("}"); types.pop_back(); vtypes.pop_back(); stages.pop_back(); flags.pop_back(); break;
}
}
@ -9869,6 +9920,7 @@ namespace {
_serializers.insert(mtpc_messageActionPinMessage, _serialize_messageActionPinMessage);
_serializers.insert(mtpc_messageActionHistoryClear, _serialize_messageActionHistoryClear);
_serializers.insert(mtpc_messageActionGameScore, _serialize_messageActionGameScore);
_serializers.insert(mtpc_messageActionPhoneCall, _serialize_messageActionPhoneCall);
_serializers.insert(mtpc_dialog, _serialize_dialog);
_serializers.insert(mtpc_photoEmpty, _serialize_photoEmpty);
_serializers.insert(mtpc_photo, _serialize_photo);
@ -9930,6 +9982,7 @@ namespace {
_serializers.insert(mtpc_inputMessagesFilterVoice, _serialize_inputMessagesFilterVoice);
_serializers.insert(mtpc_inputMessagesFilterMusic, _serialize_inputMessagesFilterMusic);
_serializers.insert(mtpc_inputMessagesFilterChatPhotos, _serialize_inputMessagesFilterChatPhotos);
_serializers.insert(mtpc_inputMessagesFilterPhoneCalls, _serialize_inputMessagesFilterPhoneCalls);
_serializers.insert(mtpc_updateNewMessage, _serialize_updateNewMessage);
_serializers.insert(mtpc_updateMessageID, _serialize_updateMessageID);
_serializers.insert(mtpc_updateDeleteMessages, _serialize_updateDeleteMessages);
@ -10310,6 +10363,7 @@ namespace {
_serializers.insert(mtpc_messages_discardEncryption, _serialize_messages_discardEncryption);
_serializers.insert(mtpc_messages_setEncryptedTyping, _serialize_messages_setEncryptedTyping);
_serializers.insert(mtpc_messages_readEncryptedHistory, _serialize_messages_readEncryptedHistory);
_serializers.insert(mtpc_messages_reportEncryptedSpam, _serialize_messages_reportEncryptedSpam);
_serializers.insert(mtpc_messages_uninstallStickerSet, _serialize_messages_uninstallStickerSet);
_serializers.insert(mtpc_messages_editChatAdmin, _serialize_messages_editChatAdmin);
_serializers.insert(mtpc_messages_reorderStickerSets, _serialize_messages_reorderStickerSets);

View File

@ -30,7 +30,7 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
namespace MTP {
namespace internal {
static constexpr mtpPrime CurrentLayer = 61;
static constexpr mtpPrime CurrentLayer = 62;
class TypeCreator;
@ -182,6 +182,7 @@ enum {
mtpc_messageActionPinMessage = 0x94bd38ed,
mtpc_messageActionHistoryClear = 0x9fbab604,
mtpc_messageActionGameScore = 0x92a72876,
mtpc_messageActionPhoneCall = 0x80e11a7f,
mtpc_dialog = 0x66ffba14,
mtpc_photoEmpty = 0x2331b22d,
mtpc_photo = 0x9288dd29,
@ -243,6 +244,7 @@ enum {
mtpc_inputMessagesFilterVoice = 0x50f5c392,
mtpc_inputMessagesFilterMusic = 0x3751b49e,
mtpc_inputMessagesFilterChatPhotos = 0x3a20ecb8,
mtpc_inputMessagesFilterPhoneCalls = 0x80c99768,
mtpc_updateNewMessage = 0x1f2b0afd,
mtpc_updateMessageID = 0x4e90bfd6,
mtpc_updateDeleteMessages = 0xa20db0e5,
@ -654,7 +656,7 @@ enum {
mtpc_messages_search = 0xd4569248,
mtpc_messages_readHistory = 0xe306d3a,
mtpc_messages_deleteHistory = 0x1c015b09,
mtpc_messages_deleteMessages = 0xa5f18925,
mtpc_messages_deleteMessages = 0xe58e95d2,
mtpc_messages_receivedMessages = 0x5a954c0,
mtpc_messages_setTyping = 0xa3825e50,
mtpc_messages_sendMessage = 0xfa88427a,
@ -681,6 +683,7 @@ enum {
mtpc_messages_sendEncryptedFile = 0x9a901b66,
mtpc_messages_sendEncryptedService = 0x32d439a4,
mtpc_messages_receivedQueue = 0x55a5bb66,
mtpc_messages_reportEncryptedSpam = 0x4b0c8c0f,
mtpc_messages_readMessageContents = 0x36a73f77,
mtpc_messages_getAllStickers = 0x1c9618b1,
mtpc_messages_getWebPagePreview = 0x25223e24,
@ -978,6 +981,7 @@ class MTPDmessageActionChannelCreate;
class MTPDmessageActionChatMigrateTo;
class MTPDmessageActionChannelMigrateFrom;
class MTPDmessageActionGameScore;
class MTPDmessageActionPhoneCall;
class MTPdialog;
class MTPDdialog;
@ -1077,6 +1081,7 @@ class MTPmessages_affectedHistory;
class MTPDmessages_affectedHistory;
class MTPmessagesFilter;
class MTPDinputMessagesFilterPhoneCalls;
class MTPupdate;
class MTPDupdateNewMessage;
@ -3910,6 +3915,16 @@ public:
return *(const MTPDmessageActionGameScore*)data;
}
MTPDmessageActionPhoneCall &_messageActionPhoneCall() {
t_assert(data != nullptr && _type == mtpc_messageActionPhoneCall);
split();
return *(MTPDmessageActionPhoneCall*)data;
}
const MTPDmessageActionPhoneCall &c_messageActionPhoneCall() const {
t_assert(data != nullptr && _type == mtpc_messageActionPhoneCall);
return *(const MTPDmessageActionPhoneCall*)data;
}
uint32 innerLength() const;
mtpTypeId type() const;
void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons);
@ -3929,6 +3944,7 @@ private:
explicit MTPmessageAction(MTPDmessageActionChatMigrateTo *_data);
explicit MTPmessageAction(MTPDmessageActionChannelMigrateFrom *_data);
explicit MTPmessageAction(MTPDmessageActionGameScore *_data);
explicit MTPmessageAction(MTPDmessageActionPhoneCall *_data);
friend class MTP::internal::TypeCreator;
@ -4999,14 +5015,24 @@ private:
};
typedef MTPBoxed<MTPmessages_affectedHistory> MTPmessages_AffectedHistory;
class MTPmessagesFilter {
class MTPmessagesFilter : private mtpDataOwner {
public:
MTPmessagesFilter() : _type(0) {
MTPmessagesFilter() : mtpDataOwner(0), _type(0) {
}
MTPmessagesFilter(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : _type(0) {
MTPmessagesFilter(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) : mtpDataOwner(0), _type(0) {
read(from, end, cons);
}
MTPDinputMessagesFilterPhoneCalls &_inputMessagesFilterPhoneCalls() {
t_assert(data != nullptr && _type == mtpc_inputMessagesFilterPhoneCalls);
split();
return *(MTPDinputMessagesFilterPhoneCalls*)data;
}
const MTPDinputMessagesFilterPhoneCalls &c_inputMessagesFilterPhoneCalls() const {
t_assert(data != nullptr && _type == mtpc_inputMessagesFilterPhoneCalls);
return *(const MTPDinputMessagesFilterPhoneCalls*)data;
}
uint32 innerLength() const;
mtpTypeId type() const;
void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons);
@ -5016,6 +5042,7 @@ public:
private:
explicit MTPmessagesFilter(mtpTypeId type);
explicit MTPmessagesFilter(MTPDinputMessagesFilterPhoneCalls *_data);
friend class MTP::internal::TypeCreator;
@ -11803,6 +11830,31 @@ public:
MTPint vscore;
};
class MTPDmessageActionPhoneCall : public mtpDataImpl<MTPDmessageActionPhoneCall> {
public:
enum class Flag : int32 {
f_reason = (1 << 0),
f_duration = (1 << 1),
MAX_FIELD = (1 << 1),
};
Q_DECLARE_FLAGS(Flags, Flag);
friend inline Flags operator~(Flag v) { return QFlag(~static_cast<int32>(v)); }
bool has_reason() const { return vflags.v & Flag::f_reason; }
bool has_duration() const { return vflags.v & Flag::f_duration; }
MTPDmessageActionPhoneCall() {
}
MTPDmessageActionPhoneCall(const MTPflags<MTPDmessageActionPhoneCall::Flags> &_flags, const MTPlong &_call_id, const MTPPhoneCallDiscardReason &_reason, MTPint _duration) : vflags(_flags), vcall_id(_call_id), vreason(_reason), vduration(_duration) {
}
MTPflags<MTPDmessageActionPhoneCall::Flags> vflags;
MTPlong vcall_id;
MTPPhoneCallDiscardReason vreason;
MTPint vduration;
};
class MTPDdialog : public mtpDataImpl<MTPDdialog> {
public:
enum class Flag : int32 {
@ -12355,6 +12407,25 @@ public:
MTPint voffset;
};
class MTPDinputMessagesFilterPhoneCalls : public mtpDataImpl<MTPDinputMessagesFilterPhoneCalls> {
public:
enum class Flag : int32 {
f_missed = (1 << 0),
MAX_FIELD = (1 << 0),
};
Q_DECLARE_FLAGS(Flags, Flag);
friend inline Flags operator~(Flag v) { return QFlag(~static_cast<int32>(v)); }
bool is_missed() const { return vflags.v & Flag::f_missed; }
MTPDinputMessagesFilterPhoneCalls() {
}
MTPDinputMessagesFilterPhoneCalls(const MTPflags<MTPDinputMessagesFilterPhoneCalls::Flags> &_flags) : vflags(_flags) {
}
MTPflags<MTPDinputMessagesFilterPhoneCalls::Flags> vflags;
};
class MTPDupdateNewMessage : public mtpDataImpl<MTPDupdateNewMessage> {
public:
MTPDupdateNewMessage() {
@ -19645,6 +19716,16 @@ public:
class MTPmessages_deleteMessages { // RPC method 'messages.deleteMessages'
public:
enum class Flag : int32 {
f_revoke = (1 << 0),
MAX_FIELD = (1 << 0),
};
Q_DECLARE_FLAGS(Flags, Flag);
friend inline Flags operator~(Flag v) { return QFlag(~static_cast<int32>(v)); }
bool is_revoke() const { return vflags.v & Flag::f_revoke; }
MTPflags<MTPmessages_deleteMessages::Flags> vflags;
MTPVector<MTPint> vid;
MTPmessages_deleteMessages() {
@ -19652,24 +19733,28 @@ public:
MTPmessages_deleteMessages(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_deleteMessages) {
read(from, end, cons);
}
MTPmessages_deleteMessages(const MTPVector<MTPint> &_id) : vid(_id) {
MTPmessages_deleteMessages(const MTPflags<MTPmessages_deleteMessages::Flags> &_flags, const MTPVector<MTPint> &_id) : vflags(_flags), vid(_id) {
}
uint32 innerLength() const {
return vid.innerLength();
return vflags.innerLength() + vid.innerLength();
}
mtpTypeId type() const {
return mtpc_messages_deleteMessages;
}
void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_deleteMessages) {
vflags.read(from, end);
vid.read(from, end);
}
void write(mtpBuffer &to) const {
vflags.write(to);
vid.write(to);
}
typedef MTPmessages_AffectedMessages ResponseType;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(MTPmessages_deleteMessages::Flags)
class MTPmessages_DeleteMessages : public MTPBoxed<MTPmessages_deleteMessages> {
public:
MTPmessages_DeleteMessages() {
@ -19678,7 +19763,7 @@ public:
}
MTPmessages_DeleteMessages(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed<MTPmessages_deleteMessages>(from, end, cons) {
}
MTPmessages_DeleteMessages(const MTPVector<MTPint> &_id) : MTPBoxed<MTPmessages_deleteMessages>(MTPmessages_deleteMessages(_id)) {
MTPmessages_DeleteMessages(const MTPflags<MTPmessages_deleteMessages::Flags> &_flags, const MTPVector<MTPint> &_id) : MTPBoxed<MTPmessages_deleteMessages>(MTPmessages_deleteMessages(_flags, _id)) {
}
};
@ -20870,6 +20955,45 @@ public:
}
};
class MTPmessages_reportEncryptedSpam { // RPC method 'messages.reportEncryptedSpam'
public:
MTPInputEncryptedChat vpeer;
MTPmessages_reportEncryptedSpam() {
}
MTPmessages_reportEncryptedSpam(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_reportEncryptedSpam) {
read(from, end, cons);
}
MTPmessages_reportEncryptedSpam(const MTPInputEncryptedChat &_peer) : vpeer(_peer) {
}
uint32 innerLength() const {
return vpeer.innerLength();
}
mtpTypeId type() const {
return mtpc_messages_reportEncryptedSpam;
}
void read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = mtpc_messages_reportEncryptedSpam) {
vpeer.read(from, end);
}
void write(mtpBuffer &to) const {
vpeer.write(to);
}
typedef MTPBool ResponseType;
};
class MTPmessages_ReportEncryptedSpam : public MTPBoxed<MTPmessages_reportEncryptedSpam> {
public:
MTPmessages_ReportEncryptedSpam() {
}
MTPmessages_ReportEncryptedSpam(const MTPmessages_reportEncryptedSpam &v) : MTPBoxed<MTPmessages_reportEncryptedSpam>(v) {
}
MTPmessages_ReportEncryptedSpam(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons = 0) : MTPBoxed<MTPmessages_reportEncryptedSpam>(from, end, cons) {
}
MTPmessages_ReportEncryptedSpam(const MTPInputEncryptedChat &_peer) : MTPBoxed<MTPmessages_reportEncryptedSpam>(MTPmessages_reportEncryptedSpam(_peer)) {
}
};
class MTPmessages_readMessageContents { // RPC method 'messages.readMessageContents'
public:
MTPVector<MTPint> vid;
@ -25719,6 +25843,9 @@ public:
inline static MTPmessageAction new_messageActionGameScore(const MTPlong &_game_id, MTPint _score) {
return MTPmessageAction(new MTPDmessageActionGameScore(_game_id, _score));
}
inline static MTPmessageAction new_messageActionPhoneCall(const MTPflags<MTPDmessageActionPhoneCall::Flags> &_flags, const MTPlong &_call_id, const MTPPhoneCallDiscardReason &_reason, MTPint _duration) {
return MTPmessageAction(new MTPDmessageActionPhoneCall(_flags, _call_id, _reason, _duration));
}
inline static MTPdialog new_dialog(const MTPflags<MTPDdialog::Flags> &_flags, const MTPPeer &_peer, MTPint _top_message, MTPint _read_inbox_max_id, MTPint _read_outbox_max_id, MTPint _unread_count, const MTPPeerNotifySettings &_notify_settings, MTPint _pts, const MTPDraftMessage &_draft) {
return MTPdialog(new MTPDdialog(_flags, _peer, _top_message, _read_inbox_max_id, _read_outbox_max_id, _unread_count, _notify_settings, _pts, _draft));
}
@ -25902,6 +26029,9 @@ public:
inline static MTPmessagesFilter new_inputMessagesFilterChatPhotos() {
return MTPmessagesFilter(mtpc_inputMessagesFilterChatPhotos);
}
inline static MTPmessagesFilter new_inputMessagesFilterPhoneCalls(const MTPflags<MTPDinputMessagesFilterPhoneCalls::Flags> &_flags) {
return MTPmessagesFilter(new MTPDinputMessagesFilterPhoneCalls(_flags));
}
inline static MTPupdate new_updateNewMessage(const MTPMessage &_message, MTPint _pts, MTPint _pts_count) {
return MTPupdate(new MTPDupdateNewMessage(_message, _pts, _pts_count));
}
@ -30051,6 +30181,10 @@ inline uint32 MTPmessageAction::innerLength() const {
const MTPDmessageActionGameScore &v(c_messageActionGameScore());
return v.vgame_id.innerLength() + v.vscore.innerLength();
}
case mtpc_messageActionPhoneCall: {
const MTPDmessageActionPhoneCall &v(c_messageActionPhoneCall());
return v.vflags.innerLength() + v.vcall_id.innerLength() + (v.has_reason() ? v.vreason.innerLength() : 0) + (v.has_duration() ? v.vduration.innerLength() : 0);
}
}
return 0;
}
@ -30118,6 +30252,14 @@ inline void MTPmessageAction::read(const mtpPrime *&from, const mtpPrime *end, m
v.vgame_id.read(from, end);
v.vscore.read(from, end);
} break;
case mtpc_messageActionPhoneCall: _type = cons; {
if (!data) setData(new MTPDmessageActionPhoneCall());
MTPDmessageActionPhoneCall &v(_messageActionPhoneCall());
v.vflags.read(from, end);
v.vcall_id.read(from, end);
if (v.has_reason()) { v.vreason.read(from, end); } else { v.vreason = MTPPhoneCallDiscardReason(); }
if (v.has_duration()) { v.vduration.read(from, end); } else { v.vduration = MTPint(); }
} break;
default: throw mtpErrorUnexpected(cons, "MTPmessageAction");
}
}
@ -30166,6 +30308,13 @@ inline void MTPmessageAction::write(mtpBuffer &to) const {
v.vgame_id.write(to);
v.vscore.write(to);
} break;
case mtpc_messageActionPhoneCall: {
const MTPDmessageActionPhoneCall &v(c_messageActionPhoneCall());
v.vflags.write(to);
v.vcall_id.write(to);
if (v.has_reason()) v.vreason.write(to);
if (v.has_duration()) v.vduration.write(to);
} break;
}
}
inline MTPmessageAction::MTPmessageAction(mtpTypeId type) : mtpDataOwner(0), _type(type) {
@ -30184,6 +30333,7 @@ inline MTPmessageAction::MTPmessageAction(mtpTypeId type) : mtpDataOwner(0), _ty
case mtpc_messageActionPinMessage: break;
case mtpc_messageActionHistoryClear: break;
case mtpc_messageActionGameScore: setData(new MTPDmessageActionGameScore()); break;
case mtpc_messageActionPhoneCall: setData(new MTPDmessageActionPhoneCall()); break;
default: throw mtpErrorBadTypeId(type, "MTPmessageAction");
}
}
@ -30207,6 +30357,8 @@ inline MTPmessageAction::MTPmessageAction(MTPDmessageActionChannelMigrateFrom *_
}
inline MTPmessageAction::MTPmessageAction(MTPDmessageActionGameScore *_data) : mtpDataOwner(_data), _type(mtpc_messageActionGameScore) {
}
inline MTPmessageAction::MTPmessageAction(MTPDmessageActionPhoneCall *_data) : mtpDataOwner(_data), _type(mtpc_messageActionPhoneCall) {
}
inline MTPmessageAction MTP_messageActionEmpty() {
return MTP::internal::TypeCreator::new_messageActionEmpty();
}
@ -30249,6 +30401,10 @@ inline MTPmessageAction MTP_messageActionHistoryClear() {
inline MTPmessageAction MTP_messageActionGameScore(const MTPlong &_game_id, MTPint _score) {
return MTP::internal::TypeCreator::new_messageActionGameScore(_game_id, _score);
}
Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDmessageActionPhoneCall::Flags)
inline MTPmessageAction MTP_messageActionPhoneCall(const MTPflags<MTPDmessageActionPhoneCall::Flags> &_flags, const MTPlong &_call_id, const MTPPhoneCallDiscardReason &_reason, MTPint _duration) {
return MTP::internal::TypeCreator::new_messageActionPhoneCall(_flags, _call_id, _reason, _duration);
}
inline MTPdialog::MTPdialog() : mtpDataOwner(new MTPDdialog()) {
}
@ -31653,6 +31809,12 @@ inline MTPmessages_affectedHistory MTP_messages_affectedHistory(MTPint _pts, MTP
}
inline uint32 MTPmessagesFilter::innerLength() const {
switch (_type) {
case mtpc_inputMessagesFilterPhoneCalls: {
const MTPDinputMessagesFilterPhoneCalls &v(c_inputMessagesFilterPhoneCalls());
return v.vflags.innerLength();
}
}
return 0;
}
inline mtpTypeId MTPmessagesFilter::type() const {
@ -31660,6 +31822,7 @@ inline mtpTypeId MTPmessagesFilter::type() const {
return _type;
}
inline void MTPmessagesFilter::read(const mtpPrime *&from, const mtpPrime *end, mtpTypeId cons) {
if (cons != _type) setData(0);
switch (cons) {
case mtpc_inputMessagesFilterEmpty: _type = cons; break;
case mtpc_inputMessagesFilterPhotos: _type = cons; break;
@ -31672,12 +31835,23 @@ inline void MTPmessagesFilter::read(const mtpPrime *&from, const mtpPrime *end,
case mtpc_inputMessagesFilterVoice: _type = cons; break;
case mtpc_inputMessagesFilterMusic: _type = cons; break;
case mtpc_inputMessagesFilterChatPhotos: _type = cons; break;
case mtpc_inputMessagesFilterPhoneCalls: _type = cons; {
if (!data) setData(new MTPDinputMessagesFilterPhoneCalls());
MTPDinputMessagesFilterPhoneCalls &v(_inputMessagesFilterPhoneCalls());
v.vflags.read(from, end);
} break;
default: throw mtpErrorUnexpected(cons, "MTPmessagesFilter");
}
}
inline void MTPmessagesFilter::write(mtpBuffer &to) const {
switch (_type) {
case mtpc_inputMessagesFilterPhoneCalls: {
const MTPDinputMessagesFilterPhoneCalls &v(c_inputMessagesFilterPhoneCalls());
v.vflags.write(to);
} break;
}
}
inline MTPmessagesFilter::MTPmessagesFilter(mtpTypeId type) : _type(type) {
inline MTPmessagesFilter::MTPmessagesFilter(mtpTypeId type) : mtpDataOwner(0), _type(type) {
switch (type) {
case mtpc_inputMessagesFilterEmpty: break;
case mtpc_inputMessagesFilterPhotos: break;
@ -31690,9 +31864,12 @@ inline MTPmessagesFilter::MTPmessagesFilter(mtpTypeId type) : _type(type) {
case mtpc_inputMessagesFilterVoice: break;
case mtpc_inputMessagesFilterMusic: break;
case mtpc_inputMessagesFilterChatPhotos: break;
case mtpc_inputMessagesFilterPhoneCalls: setData(new MTPDinputMessagesFilterPhoneCalls()); break;
default: throw mtpErrorBadTypeId(type, "MTPmessagesFilter");
}
}
inline MTPmessagesFilter::MTPmessagesFilter(MTPDinputMessagesFilterPhoneCalls *_data) : mtpDataOwner(_data), _type(mtpc_inputMessagesFilterPhoneCalls) {
}
inline MTPmessagesFilter MTP_inputMessagesFilterEmpty() {
return MTP::internal::TypeCreator::new_inputMessagesFilterEmpty();
}
@ -31726,6 +31903,10 @@ inline MTPmessagesFilter MTP_inputMessagesFilterMusic() {
inline MTPmessagesFilter MTP_inputMessagesFilterChatPhotos() {
return MTP::internal::TypeCreator::new_inputMessagesFilterChatPhotos();
}
Q_DECLARE_OPERATORS_FOR_FLAGS(MTPDinputMessagesFilterPhoneCalls::Flags)
inline MTPmessagesFilter MTP_inputMessagesFilterPhoneCalls(const MTPflags<MTPDinputMessagesFilterPhoneCalls::Flags> &_flags) {
return MTP::internal::TypeCreator::new_inputMessagesFilterPhoneCalls(_flags);
}
inline uint32 MTPupdate::innerLength() const {
switch (_type) {

View File

@ -85,8 +85,7 @@ OverviewInner::OverviewInner(OverviewWidget *overview, Ui::ScrollArea *scroll, P
_searchTimer.setSingleShot(true);
connect(&_searchTimer, SIGNAL(timeout()), this, SLOT(onSearchMessages()));
using Update = Window::Theme::BackgroundUpdate;
subscribe(Window::Theme::Background(), [this](const Update &update) {
subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) {
if (update.paletteChanged()) {
invalidateCache();
}
@ -1227,7 +1226,9 @@ void OverviewInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
if (isUponSelected > 1) {
_menu->addAction(lang(lng_context_forward_selected), _overview, SLOT(onForwardSelected()));
if (selectedForDelete == selectedForForward) {
_menu->addAction(lang(lng_context_delete_selected), _overview, SLOT(onDeleteSelected()));
_menu->addAction(lang(lng_context_delete_selected), base::lambda_guarded(this, [this] {
_overview->confirmDeleteSelectedItems();
}));
}
_menu->addAction(lang(lng_context_clear_selection), _overview, SLOT(onClearSelected()));
} else if (App::hoveredLinkItem()) {
@ -1236,7 +1237,9 @@ void OverviewInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
_menu->addAction(lang(lng_context_forward_msg), this, SLOT(forwardMessage()))->setEnabled(true);
}
if (App::hoveredLinkItem()->canDelete()) {
_menu->addAction(lang(lng_context_delete_msg), this, SLOT(deleteMessage()))->setEnabled(true);
_menu->addAction(lang(lng_context_delete_msg), base::lambda_guarded(this, [this] {
_overview->confirmDeleteContextItem();
}));
}
}
if (App::hoveredLinkItem()->id > 0) {
@ -1256,7 +1259,9 @@ void OverviewInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
if (isUponSelected > 1) {
_menu->addAction(lang(lng_context_forward_selected), _overview, SLOT(onForwardSelected()));
if (selectedForDelete == selectedForForward) {
_menu->addAction(lang(lng_context_delete_selected), _overview, SLOT(onDeleteSelected()));
_menu->addAction(lang(lng_context_delete_selected), base::lambda_guarded(this, [this] {
_overview->confirmDeleteSelectedItems();
}));
}
_menu->addAction(lang(lng_context_clear_selection), _overview, SLOT(onClearSelected()));
} else {
@ -1265,7 +1270,9 @@ void OverviewInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
_menu->addAction(lang(lng_context_forward_msg), this, SLOT(forwardMessage()))->setEnabled(true);
}
if (App::mousedItem()->canDelete()) {
_menu->addAction(lang(lng_context_delete_msg), this, SLOT(deleteMessage()))->setEnabled(true);
_menu->addAction(lang(lng_context_delete_msg), base::lambda_guarded(this, [this] {
_overview->confirmDeleteContextItem();
}));
}
}
if (App::mousedItem()->id > 0) {
@ -1404,14 +1411,6 @@ void OverviewInner::forwardMessage() {
App::main()->forwardLayer();
}
void OverviewInner::deleteMessage() {
HistoryItem *item = App::contextItem();
if (!item || item->type() != HistoryItemMsg) return;
HistoryMessage *msg = item->toHistoryMessage();
App::main()->deleteLayer((msg && msg->uploading()) ? -2 : -1);
}
MsgId OverviewInner::complexMsgId(const HistoryItem *item) const {
return item ? ((item->history() == _migrated) ? -item->id : item->id) : 0;
}
@ -2273,7 +2272,15 @@ void OverviewWidget::onForwardSelected() {
App::main()->forwardLayer(true);
}
void OverviewWidget::onDeleteSelected() {
void OverviewWidget::confirmDeleteContextItem() {
auto item = App::contextItem();
if (!item || item->type() != HistoryItemMsg) return;
auto message = item->toHistoryMessage();
App::main()->deleteLayer((message && message->uploading()) ? -2 : -1);
}
void OverviewWidget::confirmDeleteSelectedItems() {
SelectedItemSet sel;
_inner->fillSelectedItems(sel);
if (sel.isEmpty()) return;
@ -2281,49 +2288,50 @@ void OverviewWidget::onDeleteSelected() {
App::main()->deleteLayer(sel.size());
}
void OverviewWidget::onDeleteSelectedSure() {
void OverviewWidget::deleteContextItem(bool forEveryone) {
Ui::hideLayer();
SelectedItemSet sel;
_inner->fillSelectedItems(sel);
if (sel.isEmpty()) return;
QMap<PeerData*, QVector<MTPint> > ids;
for (SelectedItemSet::const_iterator i = sel.cbegin(), e = sel.cend(); i != e; ++i) {
if (i.value()->id > 0) {
ids[i.value()->history()->peer].push_back(MTP_int(i.value()->id));
}
}
onClearSelected();
for (SelectedItemSet::const_iterator i = sel.cbegin(), e = sel.cend(); i != e; ++i) {
i.value()->destroy();
}
for (QMap<PeerData*, QVector<MTPint> >::const_iterator i = ids.cbegin(), e = ids.cend(); i != e; ++i) {
App::main()->deleteMessages(i.key(), i.value());
}
}
void OverviewWidget::onDeleteContextSure() {
Ui::hideLayer();
HistoryItem *item = App::contextItem();
auto item = App::contextItem();
if (!item || item->type() != HistoryItemMsg) {
return;
}
QVector<MTPint> toDelete(1, MTP_int(item->id));
History *h = item->history();
bool wasOnServer = (item->id > 0), wasLast = (h->lastMsg == item);
auto toDelete = QVector<MTPint>(1, MTP_int(item->id));
auto history = item->history();
auto wasOnServer = (item->id > 0);
auto wasLast = (history->lastMsg == item);
item->destroy();
if (!wasOnServer && wasLast && !h->lastMsg) {
App::main()->checkPeerHistory(h->peer);
if (!wasOnServer && wasLast && !history->lastMsg) {
App::main()->checkPeerHistory(history->peer);
}
if (wasOnServer) {
App::main()->deleteMessages(h->peer, toDelete);
App::main()->deleteMessages(history->peer, toDelete, forEveryone);
}
}
void OverviewWidget::deleteSelectedItems(bool forEveryone) {
Ui::hideLayer();
SelectedItemSet selected;
_inner->fillSelectedItems(selected);
if (selected.isEmpty()) return;
QMap<PeerData*, QVector<MTPint>> idsByPeer;
for_const (auto item, selected) {
if (item->id > 0) {
idsByPeer[item->history()->peer].push_back(MTP_int(item->id));
}
}
onClearSelected();
for_const (auto item, selected) {
item->destroy();
}
for (auto i = idsByPeer.cbegin(), e = idsByPeer.cend(); i != e; ++i) {
App::main()->deleteMessages(i.key(), i.value(), forEveryone);
}
}

View File

@ -109,7 +109,6 @@ public slots:
void showContextInFolder();
void goToMessage();
void deleteMessage();
void forwardMessage();
void selectMessage();
@ -332,6 +331,11 @@ public:
RPCSender::rpcClear();
}
void confirmDeleteContextItem();
void confirmDeleteSelectedItems();
void deleteContextItem(bool forEveryone);
void deleteSelectedItems(bool forEveryone);
void ui_repaintHistoryItem(const HistoryItem *item);
void notify_historyItemLayoutChanged(const HistoryItem *item);
@ -350,9 +354,6 @@ public slots:
void onScrollTimer();
void onForwardSelected();
void onDeleteSelected();
void onDeleteSelectedSure();
void onDeleteContextSure();
void onClearSelected();
private:

View File

@ -618,8 +618,7 @@ MainWindow::MainWindow()
if (!_taskbarCreatedMsgId) {
_taskbarCreatedMsgId = RegisterWindowMessage(L"TaskbarButtonCreated");
}
using Update = Window::Theme::BackgroundUpdate;
subscribe(Window::Theme::Background(), [this](const Update &update) {
subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) {
if (update.paletteChanged()) {
_psShadowWindows.setColor(st::windowShadowFg->c);
}

View File

@ -37,14 +37,17 @@ TitleWidget::TitleWidget(QWidget *parent) : Window::TitleWidget(parent)
window()->setWindowState(Qt::WindowMinimized);
_minimize->clearState();
});
_minimize->setPointerCursor(false);
_maximizeRestore->setClickedCallback([this]() {
window()->setWindowState(_maximized ? Qt::WindowNoState : Qt::WindowMaximized);
_maximizeRestore->clearState();
});
_maximizeRestore->setPointerCursor(false);
_close->setClickedCallback([this]() {
window()->close();
_close->clearState();
});
_close->setPointerCursor(false);
setAttribute(Qt::WA_OpaquePaintEvent);
resize(width(), st::titleHeight);

View File

@ -238,6 +238,7 @@ void InnerWidget::paintRow(Painter &p, int index, TimeMs ms) {
y += st::profileCommonGroupsPadding.top();
item->peer->paintUserpic(p, rtl() ? (width() - x - st::profileCommonGroupsPhotoSize) : x, y, st::profileCommonGroupsPhotoSize);
p.setPen(st::profileMemberNameFg);
x += st::profileCommonGroupsPhotoSize + st::profileCommonGroupsNameLeft;
y += st::profileCommonGroupsNameTop;
auto nameWidth = _contentWidth - (x - _contentLeft) - st::profileCommonGroupsPadding.right();

View File

@ -69,7 +69,8 @@ CoverWidget::CoverWidget(QWidget *parent, PeerData *peer) : TWidget(parent)
auto observeEvents = ButtonsUpdateFlags
| UpdateFlag::NameChanged
| UpdateFlag::UserOnlineChanged
| UpdateFlag::MembersChanged;
| UpdateFlag::MembersChanged
| UpdateFlag::PhotoChanged;
subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(observeEvents, [this](const Notify::PeerUpdate &update) {
notifyPeerUpdated(update);
}));
@ -90,7 +91,8 @@ CoverWidget::CoverWidget(QWidget *parent, PeerData *peer) : TWidget(parent)
}
PhotoData *CoverWidget::validatePhoto() const {
PhotoData *photo = (_peer->photoId && _peer->photoId != UnknownPeerPhotoId) ? App::photo(_peer->photoId) : nullptr;
auto photo = (_peer->photoId && _peer->photoId != UnknownPeerPhotoId) ? App::photo(_peer->photoId) : nullptr;
_userpicButton->setPointerCursor(photo != nullptr && photo->date != 0);
if ((_peer->photoId == UnknownPeerPhotoId) || (_peer->photoId && (!photo || !photo->date))) {
App::api()->requestFullPeer(_peer);
return nullptr;
@ -343,6 +345,9 @@ void CoverWidget::notifyPeerUpdated(const Notify::PeerUpdate &update) {
if (update.flags & UpdateFlag::NameChanged) {
refreshNameText();
}
if (update.flags & UpdateFlag::PhotoChanged) {
validatePhoto();
}
if (update.flags & (UpdateFlag::UserOnlineChanged | UpdateFlag::MembersChanged)) {
refreshStatusText();
}

View File

@ -54,7 +54,7 @@ CoverWidget::CoverWidget(QWidget *parent, UserData *self) : BlockWidget(parent,
connect(_editName, SIGNAL(clicked()), this, SLOT(onEditName()));
connect(_editNameInline, SIGNAL(clicked()), this, SLOT(onEditName()));
auto observeEvents = Notify::PeerUpdate::Flag::NameChanged;
auto observeEvents = Notify::PeerUpdate::Flag::NameChanged | Notify::PeerUpdate::Flag::PhotoChanged;
subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(observeEvents, [this](const Notify::PeerUpdate &update) {
notifyPeerUpdated(update);
}));
@ -75,7 +75,8 @@ CoverWidget::CoverWidget(QWidget *parent, UserData *self) : BlockWidget(parent,
}
PhotoData *CoverWidget::validatePhoto() const {
PhotoData *photo = (_self->photoId && _self->photoId != UnknownPeerPhotoId) ? App::photo(_self->photoId) : nullptr;
auto photo = (_self->photoId && _self->photoId != UnknownPeerPhotoId) ? App::photo(_self->photoId) : nullptr;
_userpicButton->setPointerCursor(photo != nullptr && photo->date != 0);
if ((_self->photoId == UnknownPeerPhotoId) || (_self->photoId && (!photo || !photo->date))) {
App::api()->requestFullPeer(_self);
return nullptr;
@ -265,6 +266,9 @@ void CoverWidget::notifyPeerUpdated(const Notify::PeerUpdate &update) {
if (update.flags & Notify::PeerUpdate::Flag::NameChanged) {
refreshNameText();
}
if (update.flags & Notify::PeerUpdate::Flag::PhotoChanged) {
validatePhoto();
}
}
void CoverWidget::refreshNameText() {

View File

@ -2826,9 +2826,12 @@ void EmojiPan::paintEvent(QPaintEvent *e) {
Painter p(this);
auto ms = getms();
auto showAnimating = _a_show.animating(ms);
// This call can finish _a_show animation and destroy _showAnimation.
auto opacityAnimating = _a_opacity.animating(ms);
auto switching = (_slideAnimation != nullptr);
auto showAnimating = _a_show.animating(ms);
if (_showAnimation && !showAnimating) {
_showAnimation.reset();
if (!switching && !opacityAnimating) {
@ -2837,6 +2840,7 @@ void EmojiPan::paintEvent(QPaintEvent *e) {
}
if (showAnimating) {
t_assert(_showAnimation != nullptr);
if (auto opacity = _a_opacity.current(_hiding ? 0. : 1.)) {
_showAnimation->paintFrame(p, 0, 0, width(), _a_show.current(1.), opacity);
}

View File

@ -83,8 +83,14 @@ void AbstractButton::mouseReleaseEvent(QMouseEvent *e) {
}
}
void AbstractButton::setPointerCursor(bool enablePointerCursor) {
if (_enablePointerCursor != enablePointerCursor) {
_enablePointerCursor = enablePointerCursor;
updateCursor();
}
}
void AbstractButton::setOver(bool over, StateChangeSource source) {
setCursor(over ? style::cur_pointer : style::cur_default);
if (over && !(_state & StateFlag::Over)) {
auto was = _state;
_state |= StateFlag::Over;
@ -94,6 +100,12 @@ void AbstractButton::setOver(bool over, StateChangeSource source) {
_state &= ~State(StateFlag::Over);
onStateChanged(was, source);
}
updateCursor();
}
void AbstractButton::updateCursor() {
auto pointerCursor = _enablePointerCursor && (_state & StateFlag::Over);
setCursor(pointerCursor ? style::cur_pointer : style::cur_default);
}
void AbstractButton::setDisabled(bool disabled) {

View File

@ -48,6 +48,8 @@ public:
return _state & StateFlag::Disabled;
}
void setPointerCursor(bool enablePointerCursor);
void setAcceptBoth(bool acceptBoth = true);
void setClickedCallback(base::lambda<void()> &&callback) {
@ -96,12 +98,14 @@ protected:
}
private:
void updateCursor();
void checkIfOver(QPoint localPos);
State _state = StateFlag::None;
bool _acceptBoth = false;
Qt::KeyboardModifiers _modifiers;
bool _enablePointerCursor = true;
base::lambda<void()> _clickedCallback;

View File

@ -452,23 +452,24 @@ class AnimationCallbacksRelative : public AnimationImplementation {
public:
typedef void (Type::*Method)(float64, bool);
AnimationCallbacksRelative(Type *obj, Method method) : _started(0), _obj(obj), _method(method) {
AnimationCallbacksRelative(Type *obj, Method method) : _obj(obj), _method(method) {
}
void start() {
_started = float64(getms());
_started = getms();
}
void step(BasicAnimation *a, TimeMs ms, bool timer) {
(_obj->*_method)(ms - _started, timer);
(_obj->*_method)(qMax(ms - _started, TimeMs(0)), timer);
}
private:
float64 _started;
Type *_obj;
Method _method;
TimeMs _started = 0;
Type *_obj = nullptr;
Method _method = nullptr;
};
template <typename Type>
AnimationCallbacks animation(Type *obj, typename AnimationCallbacksRelative<Type>::Method method) {
return AnimationCallbacks(new AnimationCallbacksRelative<Type>(obj, method));
@ -487,10 +488,11 @@ public:
}
private:
Type *_obj;
Method _method;
Type *_obj = nullptr;
Method _method = nullptr;
};
template <typename Type>
AnimationCallbacks animation(Type *obj, typename AnimationCallbacksAbsolute<Type>::Method method) {
return AnimationCallbacks(new AnimationCallbacksAbsolute<Type>(obj, method));
@ -501,24 +503,25 @@ class AnimationCallbacksRelativeWithParam : public AnimationImplementation {
public:
typedef void (Type::*Method)(Param, float64, bool);
AnimationCallbacksRelativeWithParam(Param param, Type *obj, Method method) : _started(0), _param(param), _obj(obj), _method(method) {
AnimationCallbacksRelativeWithParam(Param param, Type *obj, Method method) : _param(param), _obj(obj), _method(method) {
}
void start() {
_started = float64(getms());
_started = getms();
}
void step(BasicAnimation *a, TimeMs ms, bool timer) {
(_obj->*_method)(_param, ms - _started, timer);
(_obj->*_method)(_param, qMax(ms - _started, TimeMs(0)), timer);
}
private:
float64 _started;
TimeMs _started = 0;
Param _param;
Type *_obj;
Method _method;
Type *_obj = nullptr;
Method _method = nullptr;
};
template <typename Type, typename Param>
AnimationCallbacks animation(Param param, Type *obj, typename AnimationCallbacksRelativeWithParam<Type, Param>::Method method) {
return AnimationCallbacks(new AnimationCallbacksRelativeWithParam<Type, Param>(param, obj, method));
@ -538,10 +541,11 @@ public:
private:
Param _param;
Type *_obj;
Method _method;
Type *_obj = nullptr;
Method _method = nullptr;
};
template <typename Type, typename Param>
AnimationCallbacks animation(Param param, Type *obj, typename AnimationCallbacksAbsoluteWithParam<Type, Param>::Method method) {
return AnimationCallbacks(new AnimationCallbacksAbsoluteWithParam<Type, Param>(param, obj, method));

View File

@ -24,6 +24,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "ui/widgets/popup_menu.h"
#include "mainwindow.h"
#include "ui/countryinput.h"
#include "window/window_theme.h"
#include "lang.h"
#include "numbers.h"
@ -145,9 +146,12 @@ FlatTextarea::FlatTextarea(QWidget *parent, const style::FlatTextarea &st, const
setPlaceholder(pholder);
QPalette p(palette());
p.setColor(QPalette::Text, _st.textColor->c);
setPalette(p);
subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) {
if (update.paletteChanged()) {
updatePalette();
}
});
updatePalette();
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@ -179,6 +183,12 @@ FlatTextarea::FlatTextarea(QWidget *parent, const style::FlatTextarea &st, const
}
}
void FlatTextarea::updatePalette() {
auto p = palette();
p.setColor(QPalette::Text, _st.textColor->c);
setPalette(p);
}
TextWithTags FlatTextarea::getTextWithTagsPart(int start, int end) {
TextWithTags result;
result.text = getTextPart(start, end, &result.tags);
@ -1457,9 +1467,12 @@ FlatInput::FlatInput(QWidget *parent, const style::FlatInput &st, const QString
setFont(_st.font->f);
setAlignment(_st.align);
QPalette p(palette());
p.setColor(QPalette::Text, _st.textColor->c);
setPalette(p);
subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) {
if (update.paletteChanged()) {
updatePalette();
}
});
updatePalette();
connect(this, SIGNAL(textChanged(const QString &)), this, SLOT(onTextChange(const QString &)));
connect(this, SIGNAL(textEdited(const QString &)), this, SLOT(onTextEdited()));
@ -1474,6 +1487,12 @@ FlatInput::FlatInput(QWidget *parent, const style::FlatInput &st, const QString
connect(&_touchTimer, SIGNAL(timeout()), this, SLOT(onTouchTimer()));
}
void FlatInput::updatePalette() {
auto p = palette();
p.setColor(QPalette::Text, _st.textColor->c);
setPalette(p);
}
void FlatInput::customUpDown(bool custom) {
_customUpDown = custom;
}
@ -1699,9 +1718,12 @@ InputArea::InputArea(QWidget *parent, const style::InputField &st, const QString
createPlaceholderPath();
QPalette p(palette());
p.setColor(QPalette::Text, _st.textFg->c);
setPalette(p);
subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) {
if (update.paletteChanged()) {
updatePalette();
}
});
updatePalette();
_inner->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
_inner->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@ -1736,6 +1758,12 @@ InputArea::InputArea(QWidget *parent, const style::InputField &st, const QString
finishAnimations();
}
void InputArea::updatePalette() {
auto p = palette();
p.setColor(QPalette::Text, _st.textFg->c);
setPalette(p);
}
void InputArea::onTouchTimer() {
_touchRightButton = true;
}
@ -2443,9 +2471,12 @@ InputField::InputField(QWidget *parent, const style::InputField &st, const QStri
createPlaceholderPath();
QPalette p(palette());
p.setColor(QPalette::Text, _st.textFg->c);
setPalette(p);
subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) {
if (update.paletteChanged()) {
updatePalette();
}
});
updatePalette();
_inner->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
_inner->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@ -2478,6 +2509,12 @@ InputField::InputField(QWidget *parent, const style::InputField &st, const QStri
finishAnimations();
}
void InputField::updatePalette() {
auto p = palette();
p.setColor(QPalette::Text, _st.textFg->c);
setPalette(p);
}
void InputField::onTouchTimer() {
_touchRightButton = true;
}
@ -3184,9 +3221,12 @@ MaskedInputField::MaskedInputField(QWidget *parent, const style::InputField &st,
setFont(_st.font);
setAlignment(_st.textAlign);
QPalette p(palette());
p.setColor(QPalette::Text, _st.textFg->c);
setPalette(p);
subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) {
if (update.paletteChanged()) {
updatePalette();
}
});
updatePalette();
createPlaceholderPath();
@ -3213,6 +3253,12 @@ MaskedInputField::MaskedInputField(QWidget *parent, const style::InputField &st,
finishAnimations();
}
void MaskedInputField::updatePalette() {
auto p = palette();
p.setColor(QPalette::Text, _st.textFg->c);
setPalette(p);
}
void MaskedInputField::setCorrectedText(QString &now, int &nowCursor, const QString &newText, int newPos) {
if (newPos < 0 || newPos > newText.size()) {
newPos = newText.size();

View File

@ -28,7 +28,7 @@ namespace Ui {
static UserData * const LookingUpInlineBot = SharedMemoryLocation<UserData, 0>();
class FlatTextarea : public QTextEdit {
class FlatTextarea : public QTextEdit, private base::Subscriber {
Q_OBJECT
T_WIDGET
@ -163,6 +163,8 @@ protected:
void checkContentHeight();
private:
void updatePalette();
// "start" and "end" are in coordinates of text where emoji are replaced
// by ObjectReplacementCharacter. If "end" = -1 means get text till the end.
QString getTextPart(int start, int end, TagList *outTagsList, bool *outTagsChanged = nullptr) const;
@ -240,7 +242,7 @@ inline bool operator!=(const FlatTextarea::LinkRange &a, const FlatTextarea::Lin
return !(a == b);
}
class FlatInput : public QLineEdit {
class FlatInput : public QLineEdit, private base::Subscriber {
Q_OBJECT
T_WIDGET
@ -304,6 +306,7 @@ protected:
void phPrepare(Painter &p, float64 placeholderFocused);
private:
void updatePalette();
void updatePlaceholderText();
QString _oldtext, _ph, _fullph;
@ -327,7 +330,7 @@ enum class CtrlEnterSubmit {
Both,
};
class InputArea : public TWidget {
class InputArea : public TWidget, private base::Subscriber {
Q_OBJECT
public:
@ -450,6 +453,8 @@ private:
};
friend class Inner;
void updatePalette();
bool heightAutoupdated();
void checkContentHeight();
void createPlaceholderPath();
@ -503,7 +508,7 @@ private:
};
class InputField : public TWidget {
class InputField : public TWidget, private base::Subscriber {
Q_OBJECT
public:
@ -636,6 +641,8 @@ private:
};
friend class Inner;
void updatePalette();
void createPlaceholderPath();
void setErrorShown(bool error);
@ -685,7 +692,7 @@ private:
bool _correcting = false;
};
class MaskedInputField : public QLineEdit {
class MaskedInputField : public QLineEdit, private base::Subscriber {
Q_OBJECT
T_WIDGET
@ -778,6 +785,7 @@ protected:
const style::InputField &_st;
private:
void updatePalette();
void createPlaceholderPath();
void setErrorShown(bool error);

View File

@ -27,11 +27,13 @@ namespace Ui {
ScrollShadow::ScrollShadow(ScrollArea *parent, const style::ScrollArea *st) : QWidget(parent), _st(st) {
setVisible(false);
t_assert(_st != nullptr);
t_assert(_st->shColor.v() != nullptr);
}
void ScrollShadow::paintEvent(QPaintEvent *e) {
QPainter p(this);
p.fillRect(rect(), _st->shColor->b);
Painter p(this);
p.fillRect(rect(), _st->shColor);
}
void ScrollShadow::changeVisibility(bool shown) {

View File

@ -32,12 +32,12 @@ MainWindow::MainWindow() : QWidget()
, _positionUpdatedTimer(this)
, _body(this)
, _titleText(qsl("Telegram")) {
using Update = Theme::BackgroundUpdate;
subscribe(Theme::Background(), [this](const Update &data) {
subscribe(Theme::Background(), [this](const Theme::BackgroundUpdate &data) {
if (data.paletteChanged()) {
if (_title) {
_title->update();
}
updatePalette();
}
});
subscribe(Global::RefUnreadCounterUpdate(), [this] { updateUnreadCounter(); });
@ -49,9 +49,7 @@ void MainWindow::init() {
_positionUpdatedTimer->setSingleShot(true);
connect(_positionUpdatedTimer, SIGNAL(timeout()), this, SLOT(savePositionByTimer()));
auto p = palette();
p.setColor(QPalette::Window, st::windowBg->c);
setPalette(p);
updatePalette();
if ((_title = Platform::CreateTitleWidget(this))) {
_title->init();
@ -61,6 +59,12 @@ void MainWindow::init() {
updateUnreadCounter();
}
void MainWindow::updatePalette() {
auto p = palette();
p.setColor(QPalette::Window, st::windowBg->c);
setPalette(p);
}
HitTestResult MainWindow::hitTest(const QPoint &p) const {
auto titleResult = _title ? _title->hitTest(p - _title->geometry().topLeft()) : Window::HitTestResult::None;
if (titleResult != Window::HitTestResult::None) {

View File

@ -82,6 +82,7 @@ private slots:
}
private:
void updatePalette();
void updateControlsGeometry();
void updateUnreadCounter();
void initSize();

View File

@ -28,6 +28,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "ui/widgets/buttons.h"
#include "ui/widgets/input_fields.h"
#include "dialogs/dialogs_layout.h"
#include "window/window_theme.h"
#include "styles/style_dialogs.h"
#include "styles/style_boxes.h"
#include "styles/style_window.h"
@ -505,6 +506,19 @@ Notification::Notification(History *history, PeerData *peer, PeerData *author, H
prepareActionsCache();
subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &data) {
if (data.paletteChanged()) {
updateNotifyDisplay();
if (!_buttonsCache.isNull()) {
prepareActionsCache();
}
update();
if (_background) {
_background->update();
}
}
});
show();
}
@ -851,6 +865,12 @@ HideAllButton::HideAllButton(QPoint startPosition, int shift, Direction shiftDir
hide();
createWinId();
subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &data) {
if (data.paletteChanged()) {
update();
}
});
show();
}

View File

@ -120,7 +120,7 @@ private:
namespace internal {
class Widget : public TWidget {
class Widget : public TWidget, protected base::Subscriber {
public:
enum class Direction {
Up,

View File

@ -83,7 +83,7 @@ void TopBarWidget::onForwardSelection() {
}
void TopBarWidget::onDeleteSelection() {
if (App::main()) App::main()->deleteSelectedItems();
if (App::main()) App::main()->confirmDeleteSelectedItems();
}
void TopBarWidget::onClearSelection() {

View File

@ -80,7 +80,9 @@ void MainMenu::checkSelf() {
if (auto self = App::self()) {
_userpicButton.create(this, self, st::mainMenuUserpicSize);
_userpicButton->setClickedCallback([] {
App::wnd()->showSettings();
if (auto self = App::self()) {
Ui::showPeerHistory(App::history(self), ShowAtUnreadMsgId);
}
});
_userpicButton->show();
updateControlsGeometry();

View File

@ -1,6 +1,6 @@
AppVersion 10021
AppVersion 10022
AppVersionStrMajor 0.10
AppVersionStrSmall 0.10.21
AppVersionStr 0.10.21
AppVersionStrSmall 0.10.22
AppVersionStr 0.10.22
AlphaChannel 1
BetaVersion 0