2014-05-30 08:53:19 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2014-12-01 10:47:38 +00:00
|
|
|
the official desktop version of Telegram messaging app, see https://telegram.org
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
Telegram Desktop is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
It is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
2015-10-03 13:16:42 +00:00
|
|
|
In addition, as a special exception, the copyright holders give permission
|
|
|
|
to link the code of portions of this program with the OpenSSL library.
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
|
2016-02-08 10:56:18 +00:00
|
|
|
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
2014-05-30 08:53:19 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2016-04-12 21:31:28 +00:00
|
|
|
#include "localimageloader.h"
|
|
|
|
#include "history/history_common.h"
|
|
|
|
|
|
|
|
namespace Dialogs {
|
|
|
|
class Row;
|
|
|
|
} // namespace Dialogs
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class PeerAvatarButton;
|
|
|
|
} // namespace Ui
|
|
|
|
|
|
|
|
namespace Window {
|
|
|
|
class TopBarWidget;
|
2016-05-19 12:03:51 +00:00
|
|
|
class SectionMemento;
|
|
|
|
class SectionWidget;
|
|
|
|
struct SectionSlideParams;
|
2016-04-12 21:31:28 +00:00
|
|
|
} // namespace Window
|
|
|
|
|
|
|
|
class MainWindow;
|
2016-04-09 11:02:50 +00:00
|
|
|
class ApiWrap;
|
2014-12-12 16:27:03 +00:00
|
|
|
class ConfirmBox;
|
2016-04-09 11:02:50 +00:00
|
|
|
class DialogsWidget;
|
|
|
|
class HistoryWidget;
|
|
|
|
class OverviewWidget;
|
|
|
|
class PlayerWidget;
|
2016-04-12 21:31:28 +00:00
|
|
|
class HistoryHider;
|
|
|
|
class Dropdown;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2014-08-15 11:19:32 +00:00
|
|
|
enum StackItemType {
|
|
|
|
HistoryStackItem,
|
2016-05-19 12:03:51 +00:00
|
|
|
SectionStackItem,
|
2014-08-15 11:19:32 +00:00
|
|
|
OverviewStackItem,
|
|
|
|
};
|
|
|
|
|
|
|
|
class StackItem {
|
|
|
|
public:
|
|
|
|
StackItem(PeerData *peer) : peer(peer) {
|
|
|
|
}
|
|
|
|
virtual StackItemType type() const = 0;
|
|
|
|
virtual ~StackItem() {
|
|
|
|
}
|
|
|
|
PeerData *peer;
|
|
|
|
};
|
|
|
|
|
|
|
|
class StackItemHistory : public StackItem {
|
|
|
|
public:
|
2016-05-19 12:03:51 +00:00
|
|
|
StackItemHistory(PeerData *peer, MsgId msgId, QList<MsgId> replyReturns) : StackItem(peer)
|
|
|
|
, msgId(msgId)
|
|
|
|
, replyReturns(replyReturns) {
|
2014-08-15 11:19:32 +00:00
|
|
|
}
|
|
|
|
StackItemType type() const {
|
|
|
|
return HistoryStackItem;
|
|
|
|
}
|
2015-07-17 19:17:37 +00:00
|
|
|
MsgId msgId;
|
2015-03-24 10:00:27 +00:00
|
|
|
QList<MsgId> replyReturns;
|
2014-08-15 11:19:32 +00:00
|
|
|
};
|
|
|
|
|
2016-05-19 12:03:51 +00:00
|
|
|
class StackItemSection : public StackItem {
|
2014-08-15 11:19:32 +00:00
|
|
|
public:
|
2016-05-19 12:03:51 +00:00
|
|
|
StackItemSection(std_::unique_ptr<Window::SectionMemento> &&memento);
|
|
|
|
~StackItemSection();
|
|
|
|
|
2014-08-15 11:19:32 +00:00
|
|
|
StackItemType type() const {
|
2016-05-19 12:03:51 +00:00
|
|
|
return SectionStackItem;
|
2014-08-15 11:19:32 +00:00
|
|
|
}
|
2016-05-19 12:03:51 +00:00
|
|
|
Window::SectionMemento *memento() const {
|
|
|
|
return _memento.get();
|
2014-08-15 11:19:32 +00:00
|
|
|
}
|
2016-05-19 12:03:51 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
std_::unique_ptr<Window::SectionMemento> _memento;
|
|
|
|
|
2014-08-15 11:19:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class StackItemOverview : public StackItem {
|
|
|
|
public:
|
2016-05-19 12:03:51 +00:00
|
|
|
StackItemOverview(PeerData *peer, MediaOverviewType mediaType, int32 lastWidth, int32 lastScrollTop) : StackItem(peer)
|
|
|
|
, mediaType(mediaType)
|
|
|
|
, lastWidth(lastWidth)
|
|
|
|
, lastScrollTop(lastScrollTop) {
|
2014-08-15 11:19:32 +00:00
|
|
|
}
|
|
|
|
StackItemType type() const {
|
|
|
|
return OverviewStackItem;
|
|
|
|
}
|
|
|
|
MediaOverviewType mediaType;
|
|
|
|
int32 lastWidth, lastScrollTop;
|
|
|
|
};
|
|
|
|
|
2016-02-25 16:19:54 +00:00
|
|
|
enum SilentNotifiesStatus {
|
|
|
|
SilentNotifiesDontChange,
|
|
|
|
SilentNotifiesSetSilent,
|
|
|
|
SilentNotifiesSetNotify,
|
|
|
|
};
|
|
|
|
enum NotifySettingStatus {
|
|
|
|
NotifySettingDontChange,
|
|
|
|
NotifySettingSetMuted,
|
|
|
|
NotifySettingSetNotify,
|
|
|
|
};
|
|
|
|
|
2016-04-04 21:09:46 +00:00
|
|
|
namespace InlineBots {
|
|
|
|
namespace Layout {
|
|
|
|
|
|
|
|
class ItemBase;
|
|
|
|
|
|
|
|
} // namespace Layout
|
|
|
|
} // namespace InlineBots
|
|
|
|
|
2016-08-27 04:49:18 +00:00
|
|
|
class MainWidget : public TWidget, public RPCSender, private base::Subscriber {
|
2014-05-30 08:53:19 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2016-04-12 21:31:28 +00:00
|
|
|
MainWidget(MainWindow *window);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-03-01 02:36:23 +00:00
|
|
|
void paintEvent(QPaintEvent *e) override;
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
|
|
|
void keyPressEvent(QKeyEvent *e) override;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2014-12-12 16:27:03 +00:00
|
|
|
bool needBackButton();
|
|
|
|
|
2016-06-17 18:18:01 +00:00
|
|
|
// Temporary methods, while top bar was not done inside HistoryWidget / OverviewWidget.
|
2016-04-21 17:57:29 +00:00
|
|
|
void paintTopBar(Painter &p, float64 over, int32 decreaseWidth);
|
2016-06-17 18:18:01 +00:00
|
|
|
QRect getMembersShowAreaGeometry() const;
|
|
|
|
void setMembersShowAreaActive(bool active);
|
2016-04-12 21:31:28 +00:00
|
|
|
Window::TopBarWidget *topBar();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-07-03 08:47:16 +00:00
|
|
|
PlayerWidget *player();
|
2016-04-08 09:20:10 +00:00
|
|
|
int contentScrollAddToY() const;
|
2015-07-03 08:47:16 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
void animShow(const QPixmap &bgAnimCache, bool back = false);
|
2015-12-08 12:33:37 +00:00
|
|
|
void step_show(float64 ms, bool timer);
|
2015-10-17 14:52:26 +00:00
|
|
|
void animStop_show();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
void start(const MTPUser &user);
|
2015-05-19 15:46:45 +00:00
|
|
|
|
2014-12-03 13:10:32 +00:00
|
|
|
void openLocalUrl(const QString &str);
|
2016-02-17 16:37:21 +00:00
|
|
|
void openPeerByName(const QString &name, MsgId msgId = ShowAtUnreadMsgId, const QString &startToken = QString());
|
2015-04-30 13:53:36 +00:00
|
|
|
void joinGroupByHash(const QString &hash);
|
2015-05-19 15:46:45 +00:00
|
|
|
void stickersBox(const MTPInputStickerSet &set);
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
void startFull(const MTPVector<MTPUser> &users);
|
2014-12-12 16:27:03 +00:00
|
|
|
bool started();
|
2014-05-30 08:53:19 +00:00
|
|
|
void applyNotifySetting(const MTPNotifyPeer &peer, const MTPPeerNotifySettings &settings, History *history = 0);
|
|
|
|
|
2016-02-25 16:19:54 +00:00
|
|
|
void updateNotifySetting(PeerData *peer, NotifySettingStatus notify, SilentNotifiesStatus silent = SilentNotifiesDontChange);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-01-02 14:55:24 +00:00
|
|
|
void incrementSticker(DocumentData *sticker);
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
void activate();
|
|
|
|
|
2015-09-21 20:57:42 +00:00
|
|
|
void createDialog(History *history);
|
2015-11-13 15:14:33 +00:00
|
|
|
void removeDialog(History *history);
|
2016-04-11 10:59:01 +00:00
|
|
|
void dlgUpdated();
|
|
|
|
void dlgUpdated(Dialogs::Mode list, Dialogs::Row *row);
|
2015-10-03 10:09:09 +00:00
|
|
|
void dlgUpdated(History *row, MsgId msgId);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
void windowShown();
|
|
|
|
|
2015-08-30 14:57:21 +00:00
|
|
|
void sentUpdatesReceived(uint64 randomId, const MTPUpdates &updates);
|
|
|
|
void sentUpdatesReceived(const MTPUpdates &updates) {
|
|
|
|
return sentUpdatesReceived(0, updates);
|
|
|
|
}
|
2016-03-23 16:50:40 +00:00
|
|
|
bool deleteChannelFailed(const RPCError &error);
|
2015-09-23 17:43:08 +00:00
|
|
|
void inviteToChannelDone(ChannelData *channel, const MTPUpdates &updates);
|
2014-05-30 08:53:19 +00:00
|
|
|
void historyToDown(History *hist);
|
|
|
|
void dialogsToUp();
|
2015-03-19 09:18:19 +00:00
|
|
|
void newUnreadMsg(History *history, HistoryItem *item);
|
2016-06-03 12:45:33 +00:00
|
|
|
void markActiveHistoryAsRead();
|
2015-06-17 19:43:03 +00:00
|
|
|
void historyCleared(History *history);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2014-08-22 07:41:39 +00:00
|
|
|
void peerBefore(const PeerData *inPeer, MsgId inMsg, PeerData *&outPeer, MsgId &outMsg);
|
|
|
|
void peerAfter(const PeerData *inPeer, MsgId inMsg, PeerData *&outPeer, MsgId &outMsg);
|
2014-12-15 15:55:45 +00:00
|
|
|
PeerData *historyPeer();
|
2014-05-30 08:53:19 +00:00
|
|
|
PeerData *peer();
|
2015-07-17 19:17:37 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
PeerData *activePeer();
|
2014-07-04 11:12:54 +00:00
|
|
|
MsgId activeMsgId();
|
2015-07-17 19:17:37 +00:00
|
|
|
|
2015-07-03 08:47:16 +00:00
|
|
|
PeerData *overviewPeer();
|
2014-08-21 12:18:56 +00:00
|
|
|
bool mediaTypeSwitch();
|
2016-06-06 11:35:49 +00:00
|
|
|
void showWideSection(const Window::SectionMemento &memento);
|
2014-08-21 12:18:56 +00:00
|
|
|
void showMediaOverview(PeerData *peer, MediaOverviewType type, bool back = false, int32 lastScrollTop = -1);
|
2016-07-05 14:48:36 +00:00
|
|
|
bool stackIsEmpty() const;
|
2014-08-15 11:19:32 +00:00
|
|
|
void showBackFromStack();
|
2015-07-17 19:17:37 +00:00
|
|
|
void orderWidgets();
|
2014-05-30 08:53:19 +00:00
|
|
|
QRect historyRect() const;
|
2016-05-19 12:03:51 +00:00
|
|
|
QPixmap grabForShowAnimation(const Window::SectionSlideParams ¶ms);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-10-27 02:39:02 +00:00
|
|
|
void onSendFileConfirm(const FileLoadResultPtr &file, bool ctrlShiftEnter);
|
|
|
|
void onSendFileCancel(const FileLoadResultPtr &file);
|
2015-10-28 02:41:13 +00:00
|
|
|
void onShareContactConfirm(const QString &phone, const QString &fname, const QString &lname, MsgId replyTo, bool ctrlShiftEnter);
|
|
|
|
void onShareContactCancel();
|
2016-09-11 08:38:14 +00:00
|
|
|
bool onSendSticker(DocumentData *sticker);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
void destroyData();
|
|
|
|
void updateOnlineDisplayIn(int32 msecs);
|
|
|
|
|
|
|
|
bool isActive() const;
|
2016-06-03 12:45:33 +00:00
|
|
|
bool doWeReadServerHistory() const;
|
2015-01-26 13:04:41 +00:00
|
|
|
bool lastWasOnline() const;
|
|
|
|
uint64 lastSetOnline() const;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-06-03 18:24:27 +00:00
|
|
|
void saveDraftToCloud();
|
|
|
|
void applyCloudDraft(History *history);
|
2016-06-09 14:31:10 +00:00
|
|
|
void writeDrafts(History *history);
|
2016-06-03 18:24:27 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
int32 dlgsWidth() const;
|
|
|
|
|
2014-12-12 16:27:03 +00:00
|
|
|
void forwardLayer(int32 forwardSelected = 0); // -1 - send paths
|
2014-05-30 08:53:19 +00:00
|
|
|
void deleteLayer(int32 selectedCount = -1); // -1 - context item, else selected, -2 - cancel upload
|
|
|
|
void shareContactLayer(UserData *contact);
|
2015-10-18 12:49:34 +00:00
|
|
|
void shareUrlLayer(const QString &url, const QString &text);
|
2016-04-08 14:16:52 +00:00
|
|
|
void inlineSwitchLayer(const QString &botAndQuery);
|
2014-12-12 16:27:03 +00:00
|
|
|
void hiderLayer(HistoryHider *h);
|
2014-05-30 08:53:19 +00:00
|
|
|
void noHider(HistoryHider *destroyed);
|
2015-09-07 07:52:37 +00:00
|
|
|
bool onForward(const PeerId &peer, ForwardWhatMessages what);
|
2015-10-18 12:49:34 +00:00
|
|
|
bool onShareUrl(const PeerId &peer, const QString &url, const QString &text);
|
2016-04-08 14:16:52 +00:00
|
|
|
bool onInlineSwitchChosen(const PeerId &peer, const QString &botAndQuery);
|
2014-05-30 08:53:19 +00:00
|
|
|
void onShareContact(const PeerId &peer, UserData *contact);
|
2014-07-18 10:37:34 +00:00
|
|
|
void onSendPaths(const PeerId &peer);
|
2015-06-27 13:02:00 +00:00
|
|
|
void onFilesOrForwardDrop(const PeerId &peer, const QMimeData *data);
|
2015-04-04 20:01:34 +00:00
|
|
|
bool selectingPeer(bool withConfirm = false);
|
2016-04-08 14:16:52 +00:00
|
|
|
bool selectingPeerForInlineSwitch();
|
2014-05-30 08:53:19 +00:00
|
|
|
void offerPeer(PeerId peer);
|
|
|
|
void dialogsActivate();
|
|
|
|
|
2016-06-14 16:26:41 +00:00
|
|
|
void deletePhotoLayer(PhotoData *photo);
|
|
|
|
|
2015-06-24 17:24:48 +00:00
|
|
|
DragState getDragState(const QMimeData *mime);
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
bool leaveChatFailed(PeerData *peer, const RPCError &e);
|
2015-08-04 15:01:47 +00:00
|
|
|
void deleteHistoryAfterLeave(PeerData *peer, const MTPUpdates &updates);
|
2015-09-07 07:52:37 +00:00
|
|
|
void deleteMessages(PeerData *peer, const QVector<MTPint> &ids);
|
2014-05-30 08:53:19 +00:00
|
|
|
void deletedContact(UserData *user, const MTPcontacts_Link &result);
|
2015-09-24 08:58:10 +00:00
|
|
|
void deleteConversation(PeerData *peer, bool deleteHistory = true);
|
2016-06-01 20:05:37 +00:00
|
|
|
void deleteAndExit(ChatData *chat);
|
2014-05-30 08:53:19 +00:00
|
|
|
void clearHistory(PeerData *peer);
|
2016-03-13 15:45:00 +00:00
|
|
|
void deleteAllFromUser(ChannelData *channel, UserData *from);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-09-16 13:04:08 +00:00
|
|
|
void addParticipants(PeerData *chatOrChannel, const QVector<UserData*> &users);
|
2015-06-15 17:19:24 +00:00
|
|
|
bool addParticipantFail(UserData *user, const RPCError &e);
|
2015-11-02 22:33:57 +00:00
|
|
|
bool addParticipantsFail(ChannelData *channel, const RPCError &e); // for multi invite in channels
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
void kickParticipant(ChatData *chat, UserData *user);
|
|
|
|
bool kickParticipantFail(ChatData *chat, const RPCError &e);
|
|
|
|
|
|
|
|
void checkPeerHistory(PeerData *peer);
|
|
|
|
void checkedHistory(PeerData *peer, const MTPmessages_Messages &result);
|
|
|
|
|
2015-09-09 07:46:31 +00:00
|
|
|
bool sendMessageFail(const RPCError &error);
|
2015-01-05 20:17:33 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
void forwardSelectedItems();
|
|
|
|
void deleteSelectedItems();
|
|
|
|
void clearSelectedItems();
|
|
|
|
|
2016-04-09 18:45:55 +00:00
|
|
|
Dialogs::IndexedList *contactsList();
|
|
|
|
Dialogs::IndexedList *dialogsList();
|
2015-12-31 15:27:21 +00:00
|
|
|
|
2016-04-30 17:04:14 +00:00
|
|
|
struct MessageToSend {
|
|
|
|
History *history = nullptr;
|
2016-05-05 16:04:17 +00:00
|
|
|
TextWithTags textWithTags;
|
2016-04-30 17:04:14 +00:00
|
|
|
MsgId replyTo = 0;
|
|
|
|
bool silent = false;
|
|
|
|
WebPageId webPageId = 0;
|
2016-06-03 18:24:27 +00:00
|
|
|
bool clearDraft = true;
|
2016-04-30 17:04:14 +00:00
|
|
|
};
|
|
|
|
void sendMessage(const MessageToSend &message);
|
2015-03-24 10:00:27 +00:00
|
|
|
void saveRecentHashtags(const QString &text);
|
2015-12-31 15:27:21 +00:00
|
|
|
|
2016-06-03 12:45:33 +00:00
|
|
|
void readServerHistory(History *history, ReadServerHistoryChecks checks = ReadServerHistoryChecks::OnlyIfUnread);
|
|
|
|
void unreadCountChanged(History *history);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-12-11 18:11:38 +00:00
|
|
|
uint64 animActiveTimeStart(const HistoryItem *msg) const;
|
2014-07-04 11:12:54 +00:00
|
|
|
void stopAnimActive();
|
|
|
|
|
2016-04-14 19:24:42 +00:00
|
|
|
void sendBotCommand(PeerData *peer, UserData *bot, const QString &cmd, MsgId replyTo);
|
2015-12-31 18:34:56 +00:00
|
|
|
bool insertBotCommand(const QString &cmd, bool specialGif);
|
2015-06-10 15:54:24 +00:00
|
|
|
|
2015-09-21 20:57:42 +00:00
|
|
|
void searchMessages(const QString &query, PeerData *inPeer);
|
2015-11-16 16:04:37 +00:00
|
|
|
bool preloadOverview(PeerData *peer, MediaOverviewType type);
|
2014-08-15 11:19:32 +00:00
|
|
|
void preloadOverviews(PeerData *peer);
|
2015-07-03 08:47:16 +00:00
|
|
|
void mediaOverviewUpdated(PeerData *peer, MediaOverviewType type);
|
2014-08-20 19:13:00 +00:00
|
|
|
void changingMsgId(HistoryItem *row, MsgId newId);
|
2014-10-10 12:46:20 +00:00
|
|
|
void itemRemoved(HistoryItem *item);
|
2016-03-11 12:20:58 +00:00
|
|
|
void itemEdited(HistoryItem *item);
|
2014-08-15 11:19:32 +00:00
|
|
|
|
|
|
|
void loadMediaBack(PeerData *peer, MediaOverviewType type, bool many = false);
|
2014-07-16 06:58:36 +00:00
|
|
|
|
2014-11-12 20:30:26 +00:00
|
|
|
void checkLastUpdate(bool afterSleep);
|
2014-11-25 12:15:29 +00:00
|
|
|
void showAddContact();
|
2014-11-18 12:40:43 +00:00
|
|
|
void showNewGroup();
|
2014-11-12 20:30:26 +00:00
|
|
|
|
2015-09-20 08:55:41 +00:00
|
|
|
void serviceNotification(const QString &msg, const MTPMessageMedia &media);
|
2014-12-12 16:27:03 +00:00
|
|
|
void serviceHistoryDone(const MTPmessages_Messages &msgs);
|
|
|
|
bool serviceHistoryFail(const RPCError &error);
|
|
|
|
|
2015-01-26 13:04:41 +00:00
|
|
|
bool isIdle() const;
|
2015-02-03 15:02:46 +00:00
|
|
|
|
|
|
|
QPixmap cachedBackground(const QRect &forRect, int &x, int &y);
|
|
|
|
void backgroundParams(const QRect &forRect, QRect &to, QRect &from) const;
|
|
|
|
void updateScrollColors();
|
|
|
|
|
|
|
|
void setChatBackground(const App::WallPaper &wp);
|
|
|
|
bool chatBackgroundLoading();
|
2016-06-22 13:39:54 +00:00
|
|
|
float64 chatBackgroundProgress() const;
|
2015-02-03 15:02:46 +00:00
|
|
|
void checkChatBackground();
|
|
|
|
ImagePtr newBackgroundThumb();
|
2015-03-19 09:18:19 +00:00
|
|
|
|
|
|
|
ApiWrap *api();
|
2016-03-10 10:15:21 +00:00
|
|
|
void messageDataReceived(ChannelData *channel, MsgId msgId);
|
2015-11-24 16:19:18 +00:00
|
|
|
void updateBotKeyboard(History *h);
|
2015-03-24 10:00:27 +00:00
|
|
|
|
|
|
|
void pushReplyReturn(HistoryItem *item);
|
2015-12-31 15:27:21 +00:00
|
|
|
|
2015-03-24 10:00:27 +00:00
|
|
|
bool hasForwardingItems();
|
|
|
|
void fillForwardingInfo(Text *&from, Text *&text, bool &serviceColor, ImagePtr &preview);
|
|
|
|
void updateForwardingTexts();
|
|
|
|
void cancelForwarding();
|
2016-05-27 16:47:46 +00:00
|
|
|
void finishForwarding(History *hist, bool silent); // send them
|
2015-03-24 10:00:27 +00:00
|
|
|
|
2016-02-12 18:18:32 +00:00
|
|
|
void mediaMarkRead(DocumentData *data);
|
2015-04-30 13:53:36 +00:00
|
|
|
void mediaMarkRead(const HistoryItemsMap &items);
|
|
|
|
|
2015-04-07 23:03:32 +00:00
|
|
|
void webPageUpdated(WebPageData *page);
|
2015-04-30 13:53:36 +00:00
|
|
|
void updateMutedIn(int32 seconds);
|
2015-04-07 23:03:32 +00:00
|
|
|
|
2015-05-19 15:46:45 +00:00
|
|
|
void updateStickers();
|
2015-12-11 18:11:38 +00:00
|
|
|
|
2015-07-17 19:17:37 +00:00
|
|
|
void choosePeer(PeerId peerId, MsgId showAtMsgId); // does offerPeer or showPeerHistory
|
|
|
|
void clearBotStartToken(PeerData *peer);
|
|
|
|
|
2015-09-07 15:53:46 +00:00
|
|
|
void contactsReceived();
|
|
|
|
|
2015-09-13 08:41:27 +00:00
|
|
|
void ptsWaiterStartTimerFor(ChannelData *channel, int32 ms); // ms <= 0 - stop timer
|
2015-09-21 20:57:42 +00:00
|
|
|
void feedUpdates(const MTPUpdates &updates, uint64 randomId = 0);
|
2015-09-13 08:41:27 +00:00
|
|
|
void feedUpdate(const MTPUpdate &update);
|
2015-09-12 19:00:56 +00:00
|
|
|
void updateAfterDrag();
|
2015-09-13 08:41:27 +00:00
|
|
|
|
2015-09-16 13:04:08 +00:00
|
|
|
void ctrlEnterSubmitUpdated();
|
|
|
|
void setInnerFocus();
|
|
|
|
|
2015-09-21 20:57:42 +00:00
|
|
|
void scheduleViewIncrement(HistoryItem *item);
|
|
|
|
|
|
|
|
void gotRangeDifference(ChannelData *channel, const MTPupdates_ChannelDifference &diff);
|
|
|
|
void onSelfParticipantUpdated(ChannelData *channel);
|
|
|
|
|
2015-10-01 14:05:05 +00:00
|
|
|
bool contentOverlapped(const QRect &globalRect);
|
|
|
|
|
2015-10-17 14:52:26 +00:00
|
|
|
QPixmap grabTopBar();
|
|
|
|
QPixmap grabInner();
|
|
|
|
|
2016-04-09 11:02:50 +00:00
|
|
|
void rpcClear() override;
|
2016-02-28 12:36:23 +00:00
|
|
|
|
2015-12-23 16:48:44 +00:00
|
|
|
bool isItemVisible(HistoryItem *item);
|
|
|
|
|
2016-04-14 16:08:36 +00:00
|
|
|
void closePlayer();
|
|
|
|
|
2016-04-06 17:02:22 +00:00
|
|
|
void app_sendBotCallback(const HistoryMessageReplyMarkup::Button *button, const HistoryItem *msg, int row, int col);
|
|
|
|
|
2015-12-27 21:37:48 +00:00
|
|
|
void ui_repaintHistoryItem(const HistoryItem *item);
|
2016-04-04 21:09:46 +00:00
|
|
|
void ui_repaintInlineItem(const InlineBots::Layout::ItemBase *layout);
|
|
|
|
bool ui_isInlineItemVisible(const InlineBots::Layout::ItemBase *layout);
|
2015-12-30 19:09:20 +00:00
|
|
|
bool ui_isInlineItemBeingChosen();
|
2016-07-05 14:48:36 +00:00
|
|
|
void ui_showPeerHistory(quint64 peer, qint32 msgId, Ui::ShowWay way);
|
2016-03-29 17:17:00 +00:00
|
|
|
PeerData *ui_getPeerForMouseAction();
|
2015-12-13 11:17:15 +00:00
|
|
|
|
|
|
|
void notify_botCommandsChanged(UserData *bot);
|
2016-01-01 09:58:05 +00:00
|
|
|
void notify_inlineBotRequesting(bool requesting);
|
2016-04-01 15:32:26 +00:00
|
|
|
void notify_replyMarkupUpdated(const HistoryItem *item);
|
2016-04-08 09:20:10 +00:00
|
|
|
void notify_inlineKeyboardMoved(const HistoryItem *item, int oldKeyboardTop, int newKeyboardTop);
|
2016-08-12 16:28:10 +00:00
|
|
|
bool notify_switchInlineBotButtonReceived(const QString &query, UserData *samePeerBot, MsgId samePeerReplyTo);
|
2015-12-13 11:17:15 +00:00
|
|
|
void notify_userIsBotChanged(UserData *bot);
|
|
|
|
void notify_userIsContactChanged(UserData *user, bool fromThisApp);
|
|
|
|
void notify_migrateUpdated(PeerData *peer);
|
2015-12-27 21:37:48 +00:00
|
|
|
void notify_clipStopperHidden(ClipStopperType type);
|
2015-12-13 11:17:15 +00:00
|
|
|
void notify_historyItemLayoutChanged(const HistoryItem *item);
|
2016-04-10 18:18:26 +00:00
|
|
|
void notify_inlineItemLayoutChanged(const InlineBots::Layout::ItemBase *layout);
|
2016-04-11 10:59:01 +00:00
|
|
|
void notify_historyMuteUpdated(History *history);
|
2016-03-19 16:55:15 +00:00
|
|
|
void notify_handlePendingHistoryUpdate();
|
2015-12-07 13:05:00 +00:00
|
|
|
|
2016-07-14 11:20:46 +00:00
|
|
|
bool cmd_search();
|
|
|
|
bool cmd_next_chat();
|
|
|
|
bool cmd_previous_chat();
|
2016-02-27 19:39:51 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
~MainWidget();
|
|
|
|
|
|
|
|
signals:
|
|
|
|
|
|
|
|
void peerUpdated(PeerData *peer);
|
|
|
|
void peerNameChanged(PeerData *peer, const PeerData::Names &oldNames, const PeerData::NameFirstChars &oldChars);
|
|
|
|
void peerPhotoChanged(PeerData *peer);
|
2016-04-09 18:45:55 +00:00
|
|
|
void dialogRowReplaced(Dialogs::Row *oldRow, Dialogs::Row *newRow);
|
2014-05-30 08:53:19 +00:00
|
|
|
void dialogsUpdated();
|
2015-05-19 15:46:45 +00:00
|
|
|
void stickersUpdated();
|
2015-12-27 21:37:48 +00:00
|
|
|
void savedGifsUpdated();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
2015-04-07 23:03:32 +00:00
|
|
|
void webPagesUpdate();
|
|
|
|
|
2015-06-30 21:07:05 +00:00
|
|
|
void audioPlayProgress(const AudioMsgId &audioId);
|
2015-12-30 19:09:20 +00:00
|
|
|
void documentLoadProgress(FileLoader *loader);
|
|
|
|
void documentLoadFailed(FileLoader *loader, bool started);
|
2014-05-30 08:53:19 +00:00
|
|
|
void documentLoadRetry();
|
2015-12-31 05:34:43 +00:00
|
|
|
void inlineResultLoadProgress(FileLoader *loader);
|
|
|
|
void inlineResultLoadFailed(FileLoader *loader, bool started);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
void dialogsCancelled();
|
|
|
|
|
|
|
|
void onParentResize(const QSize &newSize);
|
|
|
|
void getDifference();
|
2015-09-13 08:41:27 +00:00
|
|
|
void onGetDifferenceTimeByPts();
|
|
|
|
void onGetDifferenceTimeAfterFail();
|
2015-04-16 14:59:42 +00:00
|
|
|
void mtpPing();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-01-26 13:04:41 +00:00
|
|
|
void updateOnline(bool gotOtherOffline = false);
|
|
|
|
void checkIdleFinish();
|
2014-05-30 08:53:19 +00:00
|
|
|
void updateOnlineDisplay();
|
|
|
|
|
|
|
|
void onTopBarClick();
|
2015-10-03 10:09:09 +00:00
|
|
|
void onHistoryShown(History *history, MsgId atMsgId);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-08-04 15:01:47 +00:00
|
|
|
void searchInPeer(PeerData *peer);
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
void onUpdateNotifySettings();
|
|
|
|
|
2014-08-21 12:18:56 +00:00
|
|
|
void onPhotosSelect();
|
|
|
|
void onVideosSelect();
|
2015-10-23 19:24:05 +00:00
|
|
|
void onSongsSelect();
|
2014-08-21 12:18:56 +00:00
|
|
|
void onDocumentsSelect();
|
|
|
|
void onAudiosSelect();
|
2015-08-28 15:15:56 +00:00
|
|
|
void onLinksSelect();
|
2014-08-21 12:18:56 +00:00
|
|
|
|
2014-12-12 16:27:03 +00:00
|
|
|
void onForwardCancel(QObject *obj = 0);
|
|
|
|
|
2015-02-03 15:02:46 +00:00
|
|
|
void onCacheBackground();
|
|
|
|
|
2015-04-30 13:53:36 +00:00
|
|
|
void onInviteImport();
|
|
|
|
|
|
|
|
void onUpdateMuted();
|
|
|
|
|
2015-05-19 15:46:45 +00:00
|
|
|
void onStickersInstalled(uint64 setId);
|
2015-09-21 20:57:42 +00:00
|
|
|
void onFullPeerUpdated(PeerData *peer);
|
|
|
|
|
|
|
|
void onViewsIncrement();
|
2015-09-25 07:47:32 +00:00
|
|
|
void onActiveChannelUpdateFull();
|
2015-05-19 15:46:45 +00:00
|
|
|
|
2015-11-26 17:34:52 +00:00
|
|
|
void onDownloadPathSettings();
|
|
|
|
|
2016-03-30 16:42:01 +00:00
|
|
|
void onSharePhoneWithBot(PeerData *recipient);
|
|
|
|
|
2016-07-05 14:48:36 +00:00
|
|
|
void ui_showPeerHistoryAsync(quint64 peerId, qint32 showAtMsgId, Ui::ShowWay way);
|
2016-03-19 16:55:15 +00:00
|
|
|
void ui_autoplayMediaInlineAsync(qint32 channelId, qint32 msgId);
|
2015-12-13 11:17:15 +00:00
|
|
|
|
2016-06-14 16:26:41 +00:00
|
|
|
private slots:
|
|
|
|
|
|
|
|
void onDeletePhotoSure();
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
private:
|
2016-08-27 04:49:18 +00:00
|
|
|
void updateAdaptiveLayout();
|
|
|
|
|
2015-09-06 10:17:09 +00:00
|
|
|
void sendReadRequest(PeerData *peer, MsgId upTo);
|
2016-06-03 12:45:33 +00:00
|
|
|
void channelReadDone(PeerData *peer, const MTPBool &result);
|
2016-06-06 15:16:52 +00:00
|
|
|
void historyReadDone(PeerData *peer, const MTPmessages_AffectedMessages &result);
|
2015-09-06 10:17:09 +00:00
|
|
|
bool readRequestFail(PeerData *peer, const RPCError &error);
|
|
|
|
void readRequestDone(PeerData *peer);
|
|
|
|
|
2015-09-07 07:52:37 +00:00
|
|
|
void messagesAffected(PeerData *peer, const MTPmessages_AffectedMessages &result);
|
2015-11-18 13:11:56 +00:00
|
|
|
void overviewLoaded(History *history, const MTPmessages_Messages &result, mtpRequestId req);
|
2014-08-15 11:19:32 +00:00
|
|
|
|
2016-05-19 12:03:51 +00:00
|
|
|
Window::SectionSlideParams prepareShowAnimation(bool willHaveTopBarShadow);
|
2016-06-06 11:35:49 +00:00
|
|
|
void showWideSectionAnimated(const Window::SectionMemento *memento, bool back);
|
2016-05-19 12:03:51 +00:00
|
|
|
|
|
|
|
// All this methods use the prepareShowAnimation().
|
|
|
|
Window::SectionSlideParams prepareWideSectionAnimation(Window::SectionWidget *section);
|
|
|
|
Window::SectionSlideParams prepareHistoryAnimation(PeerId historyPeerId);
|
|
|
|
Window::SectionSlideParams prepareOverviewAnimation();
|
|
|
|
Window::SectionSlideParams prepareDialogsAnimation();
|
|
|
|
|
2016-07-05 14:48:36 +00:00
|
|
|
void saveSectionInStack();
|
|
|
|
|
2016-04-08 09:20:10 +00:00
|
|
|
bool _started = false;
|
2014-12-12 16:27:03 +00:00
|
|
|
|
2016-04-08 09:20:10 +00:00
|
|
|
uint64 failedObjId = 0;
|
2014-05-30 08:53:19 +00:00
|
|
|
QString failedFileName;
|
|
|
|
void loadFailed(mtpFileLoader *loader, bool started, const char *retrySlot);
|
|
|
|
|
2015-03-24 10:00:27 +00:00
|
|
|
SelectedItemSet _toForward;
|
|
|
|
Text _toForwardFrom, _toForwardText;
|
2016-04-08 09:20:10 +00:00
|
|
|
int32 _toForwardNameVersion = 0;
|
2015-03-24 10:00:27 +00:00
|
|
|
|
2015-04-07 23:03:32 +00:00
|
|
|
QMap<WebPageId, bool> _webPagesUpdated;
|
|
|
|
QTimer _webPageUpdater;
|
|
|
|
|
2015-04-30 13:53:36 +00:00
|
|
|
SingleTimer _updateMutedTimer;
|
|
|
|
|
2015-09-13 08:41:27 +00:00
|
|
|
enum GetChannelDifferenceFrom {
|
|
|
|
GetChannelDifferenceFromUnknown,
|
|
|
|
GetChannelDifferenceFromPtsGap,
|
|
|
|
GetChannelDifferenceFromFail,
|
|
|
|
};
|
|
|
|
void getChannelDifference(ChannelData *channel, GetChannelDifferenceFrom from = GetChannelDifferenceFromUnknown);
|
2014-05-30 08:53:19 +00:00
|
|
|
void gotDifference(const MTPupdates_Difference &diff);
|
|
|
|
bool failDifference(const RPCError &e);
|
|
|
|
void feedDifference(const MTPVector<MTPUser> &users, const MTPVector<MTPChat> &chats, const MTPVector<MTPMessage> &msgs, const MTPVector<MTPUpdate> &other);
|
|
|
|
void gotState(const MTPupdates_State &state);
|
|
|
|
void updSetState(int32 pts, int32 date, int32 qts, int32 seq);
|
2015-09-13 08:41:27 +00:00
|
|
|
void gotChannelDifference(ChannelData *channel, const MTPupdates_ChannelDifference &diff);
|
|
|
|
bool failChannelDifference(ChannelData *channel, const RPCError &err);
|
|
|
|
void failDifferenceStartTimerFor(ChannelData *channel);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-09-21 20:57:42 +00:00
|
|
|
void feedUpdateVector(const MTPVector<MTPUpdate> &updates, bool skipMessageIds = false);
|
2014-05-30 08:53:19 +00:00
|
|
|
void feedMessageIds(const MTPVector<MTPUpdate> &updates);
|
|
|
|
|
2016-06-03 12:45:33 +00:00
|
|
|
struct DeleteHistoryRequest {
|
|
|
|
PeerData *peer;
|
|
|
|
bool justClearHistory;
|
|
|
|
};
|
|
|
|
void deleteHistoryPart(DeleteHistoryRequest request, const MTPmessages_AffectedHistory &result);
|
2016-03-13 15:45:00 +00:00
|
|
|
struct DeleteAllFromUserParams {
|
|
|
|
ChannelData *channel;
|
|
|
|
UserData *from;
|
|
|
|
};
|
|
|
|
void deleteAllFromUserPart(DeleteAllFromUserParams params, const MTPmessages_AffectedHistory &result);
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
void updateReceived(const mtpPrime *from, const mtpPrime *end);
|
|
|
|
bool updateFail(const RPCError &e);
|
|
|
|
|
2016-02-17 16:37:21 +00:00
|
|
|
void usernameResolveDone(QPair<MsgId, QString> msgIdAndStartToken, const MTPcontacts_ResolvedPeer &result);
|
2014-12-05 13:44:27 +00:00
|
|
|
bool usernameResolveFail(QString name, const RPCError &error);
|
2014-12-03 13:10:32 +00:00
|
|
|
|
2015-04-30 13:53:36 +00:00
|
|
|
void inviteCheckDone(QString hash, const MTPChatInvite &invite);
|
|
|
|
bool inviteCheckFail(const RPCError &error);
|
|
|
|
QString _inviteHash;
|
|
|
|
void inviteImportDone(const MTPUpdates &result);
|
|
|
|
bool inviteImportFail(const RPCError &error);
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
void hideAll();
|
|
|
|
void showAll();
|
|
|
|
|
2014-08-15 11:19:32 +00:00
|
|
|
void overviewPreloaded(PeerData *data, const MTPmessages_Messages &result, mtpRequestId req);
|
|
|
|
bool overviewFailed(PeerData *data, const RPCError &error, mtpRequestId req);
|
|
|
|
|
2016-08-27 04:49:18 +00:00
|
|
|
void clearCachedBackground();
|
|
|
|
|
2015-10-17 14:52:26 +00:00
|
|
|
Animation _a_show;
|
|
|
|
QPixmap _cacheUnder, _cacheOver;
|
|
|
|
anim::ivalue a_coordUnder, a_coordOver;
|
|
|
|
anim::fvalue a_shadow;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-06-07 19:59:39 +00:00
|
|
|
int _dialogsWidth;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-05-14 16:57:06 +00:00
|
|
|
PlainShadow _sideShadow;
|
|
|
|
|
2016-04-12 21:31:28 +00:00
|
|
|
ChildWidget<DialogsWidget> _dialogs;
|
|
|
|
ChildWidget<HistoryWidget> _history;
|
2016-05-19 12:03:51 +00:00
|
|
|
ChildWidget<Window::SectionWidget> _wideSection = { nullptr };
|
2016-04-14 13:03:03 +00:00
|
|
|
ChildWidget<OverviewWidget> _overview = { nullptr };
|
2016-04-12 21:31:28 +00:00
|
|
|
ChildWidget<PlayerWidget> _player;
|
|
|
|
ChildWidget<Window::TopBarWidget> _topBar;
|
2016-04-08 09:20:10 +00:00
|
|
|
ConfirmBox *_forwardConfirm = nullptr; // for single column layout
|
2016-04-14 13:03:03 +00:00
|
|
|
ChildWidget<HistoryHider> _hider = { nullptr };
|
2016-07-05 14:48:36 +00:00
|
|
|
std_::vector_of_moveable<std_::unique_ptr<StackItem>> _stack;
|
2016-04-08 09:20:10 +00:00
|
|
|
PeerData *_peerInStack = nullptr;
|
|
|
|
MsgId _msgIdInStack = 0;
|
2015-12-07 10:06:59 +00:00
|
|
|
|
2016-04-08 09:20:10 +00:00
|
|
|
int _playerHeight = 0;
|
|
|
|
int _contentScrollAddToY = 0;
|
2015-07-03 08:47:16 +00:00
|
|
|
|
2016-04-12 21:31:28 +00:00
|
|
|
ChildWidget<Dropdown> _mediaType;
|
2016-04-08 09:20:10 +00:00
|
|
|
int32 _mediaTypeMask = 0;
|
2014-08-21 12:18:56 +00:00
|
|
|
|
2016-04-08 09:20:10 +00:00
|
|
|
int32 updDate = 0;
|
|
|
|
int32 updQts = -1;
|
|
|
|
int32 updSeq = 0;
|
2014-11-12 20:30:26 +00:00
|
|
|
SingleTimer noUpdatesTimer;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-09-13 08:41:27 +00:00
|
|
|
bool ptsUpdated(int32 pts, int32 ptsCount);
|
|
|
|
bool ptsUpdated(int32 pts, int32 ptsCount, const MTPUpdates &updates);
|
|
|
|
bool ptsUpdated(int32 pts, int32 ptsCount, const MTPUpdate &update);
|
2015-09-20 09:54:22 +00:00
|
|
|
void ptsApplySkippedUpdates();
|
2015-09-13 08:41:27 +00:00
|
|
|
PtsWaiter _ptsWaiter;
|
2016-06-22 18:41:13 +00:00
|
|
|
bool requestingDifference() const {
|
|
|
|
return _ptsWaiter.requesting();
|
|
|
|
}
|
2015-09-13 08:41:27 +00:00
|
|
|
|
|
|
|
typedef QMap<ChannelData*, uint64> ChannelGetDifferenceTime;
|
|
|
|
ChannelGetDifferenceTime _channelGetDifferenceTimeByPts, _channelGetDifferenceTimeAfterFail;
|
2016-04-08 09:20:10 +00:00
|
|
|
uint64 _getDifferenceTimeByPts = 0;
|
|
|
|
uint64 _getDifferenceTimeAfterFail = 0;
|
2015-09-13 08:41:27 +00:00
|
|
|
|
|
|
|
bool getDifferenceTimeChanged(ChannelData *channel, int32 ms, ChannelGetDifferenceTime &channelCurTime, uint64 &curTime);
|
|
|
|
|
|
|
|
SingleTimer _byPtsTimer;
|
|
|
|
|
|
|
|
QMap<int32, MTPUpdates> _bySeqUpdates;
|
|
|
|
SingleTimer _bySeqTimer;
|
|
|
|
|
2016-03-11 15:01:32 +00:00
|
|
|
SingleTimer _byMinChannelTimer;
|
|
|
|
|
2016-04-08 09:20:10 +00:00
|
|
|
mtpRequestId _onlineRequest = 0;
|
2015-01-26 13:04:41 +00:00
|
|
|
SingleTimer _onlineTimer, _onlineUpdater, _idleFinishTimer;
|
2016-04-08 09:20:10 +00:00
|
|
|
bool _lastWasOnline = false;
|
|
|
|
uint64 _lastSetOnline = 0;
|
|
|
|
bool _isIdle = false;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
QSet<PeerData*> updateNotifySettingPeers;
|
2014-11-12 20:30:26 +00:00
|
|
|
SingleTimer updateNotifySettingTimer;
|
2015-12-31 15:27:21 +00:00
|
|
|
|
2015-09-16 21:15:13 +00:00
|
|
|
typedef QMap<PeerData*, QPair<mtpRequestId, MsgId> > ReadRequests;
|
2014-06-15 12:31:03 +00:00
|
|
|
ReadRequests _readRequests;
|
2015-09-06 10:17:09 +00:00
|
|
|
typedef QMap<PeerData*, MsgId> ReadRequestsPending;
|
|
|
|
ReadRequestsPending _readRequestsPending;
|
2014-08-15 11:19:32 +00:00
|
|
|
|
|
|
|
typedef QMap<PeerData*, mtpRequestId> OverviewsPreload;
|
|
|
|
OverviewsPreload _overviewPreload[OverviewCount], _overviewLoad[OverviewCount];
|
2014-11-05 17:43:32 +00:00
|
|
|
|
2016-04-08 09:20:10 +00:00
|
|
|
int32 _failDifferenceTimeout = 1; // growing timeout for getDifference calls, if it fails
|
2015-09-13 08:41:27 +00:00
|
|
|
typedef QMap<ChannelData*, int32> ChannelFailDifferenceTimeout;
|
|
|
|
ChannelFailDifferenceTimeout _channelFailDifferenceTimeout; // growing timeout for getChannelDifference calls, if it fails
|
2014-11-12 20:30:26 +00:00
|
|
|
SingleTimer _failDifferenceTimer;
|
|
|
|
|
2016-04-08 09:20:10 +00:00
|
|
|
uint64 _lastUpdateTime = 0;
|
|
|
|
bool _handlingChannelDifference = false;
|
2015-02-03 15:02:46 +00:00
|
|
|
|
|
|
|
QPixmap _cachedBackground;
|
|
|
|
QRect _cachedFor, _willCacheFor;
|
2016-04-08 09:20:10 +00:00
|
|
|
int _cachedX = 0;
|
|
|
|
int _cachedY = 0;
|
2015-02-03 15:02:46 +00:00
|
|
|
SingleTimer _cacheBackgroundTimer;
|
|
|
|
|
2015-09-21 20:57:42 +00:00
|
|
|
typedef QMap<ChannelData*, bool> UpdatedChannels;
|
|
|
|
UpdatedChannels _updatedChannels;
|
|
|
|
|
2016-06-14 16:26:41 +00:00
|
|
|
PhotoData *_deletingPhoto = nullptr;
|
|
|
|
|
2015-09-21 20:57:42 +00:00
|
|
|
typedef QMap<MsgId, bool> ViewsIncrementMap;
|
|
|
|
typedef QMap<PeerData*, ViewsIncrementMap> ViewsIncrement;
|
|
|
|
ViewsIncrement _viewsIncremented, _viewsToIncrement;
|
|
|
|
typedef QMap<PeerData*, mtpRequestId> ViewsIncrementRequests;
|
|
|
|
ViewsIncrementRequests _viewsIncrementRequests;
|
|
|
|
typedef QMap<mtpRequestId, PeerData*> ViewsIncrementByRequest;
|
|
|
|
ViewsIncrementByRequest _viewsIncrementByRequest;
|
|
|
|
SingleTimer _viewsIncrementTimer;
|
|
|
|
void viewsIncrementDone(QVector<MTPint> ids, const MTPVector<MTPint> &result, mtpRequestId req);
|
|
|
|
bool viewsIncrementFail(const RPCError &error, mtpRequestId req);
|
|
|
|
|
2016-04-12 21:31:28 +00:00
|
|
|
std_::unique_ptr<App::WallPaper> _background;
|
2015-02-03 15:02:46 +00:00
|
|
|
|
2016-04-12 21:31:28 +00:00
|
|
|
std_::unique_ptr<ApiWrap> _api;
|
2015-03-19 09:18:19 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
};
|