2014-05-30 08:53:19 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2014-05-30 08:53:19 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2019-01-18 11:26:43 +00:00
|
|
|
#include "base/timer.h"
|
2017-11-30 17:33:27 +00:00
|
|
|
#include "base/weak_ptr.h"
|
2017-09-13 16:57:44 +00:00
|
|
|
#include "ui/rp_widget.h"
|
2019-04-02 09:13:30 +00:00
|
|
|
#include "ui/effects/animations.h"
|
2018-11-05 11:16:09 +00:00
|
|
|
#include "media/player/media_player_float.h"
|
2019-01-04 11:09:48 +00:00
|
|
|
#include "data/data_pts_waiter.h"
|
2019-11-18 09:28:14 +00:00
|
|
|
#include "mtproto/mtproto_rpc_sender.h"
|
2016-04-12 21:31:28 +00:00
|
|
|
|
2017-12-18 15:44:50 +00:00
|
|
|
struct HistoryMessageMarkupButton;
|
|
|
|
class MainWindow;
|
|
|
|
class ConfirmBox;
|
|
|
|
class HistoryWidget;
|
|
|
|
class StackItem;
|
2017-12-19 16:57:42 +00:00
|
|
|
struct FileLoadResult;
|
2019-09-13 06:06:02 +00:00
|
|
|
class History;
|
2020-05-29 14:08:18 +00:00
|
|
|
class Image;
|
2017-12-18 15:44:50 +00:00
|
|
|
|
2019-08-12 12:11:34 +00:00
|
|
|
namespace Api {
|
|
|
|
struct SendAction;
|
|
|
|
} // namespace Api
|
|
|
|
|
2019-07-24 11:45:24 +00:00
|
|
|
namespace Main {
|
|
|
|
class Session;
|
|
|
|
} // namespace Main
|
|
|
|
|
2017-01-01 16:45:20 +00:00
|
|
|
namespace Notify {
|
|
|
|
struct PeerUpdate;
|
|
|
|
} // namespace Notify
|
|
|
|
|
2019-01-03 12:36:01 +00:00
|
|
|
namespace Data {
|
2019-01-28 13:59:49 +00:00
|
|
|
class WallPaper;
|
2019-01-03 12:36:01 +00:00
|
|
|
} // namespace Data
|
|
|
|
|
2016-04-12 21:31:28 +00:00
|
|
|
namespace Dialogs {
|
2018-01-04 17:15:04 +00:00
|
|
|
struct RowDescriptor;
|
2016-04-12 21:31:28 +00:00
|
|
|
class Row;
|
2018-01-13 12:45:11 +00:00
|
|
|
class Key;
|
2019-04-24 10:15:10 +00:00
|
|
|
class Widget;
|
2016-04-12 21:31:28 +00:00
|
|
|
} // namespace Dialogs
|
|
|
|
|
2016-09-17 19:28:33 +00:00
|
|
|
namespace Media {
|
|
|
|
namespace Player {
|
|
|
|
class Widget;
|
2016-10-12 19:34:25 +00:00
|
|
|
class VolumeWidget;
|
|
|
|
class Panel;
|
2019-03-04 11:28:52 +00:00
|
|
|
struct TrackState;
|
2016-09-17 19:28:33 +00:00
|
|
|
} // namespace Player
|
|
|
|
} // namespace Media
|
|
|
|
|
2018-06-20 00:02:36 +00:00
|
|
|
namespace Export {
|
|
|
|
namespace View {
|
|
|
|
class TopBar;
|
|
|
|
class PanelController;
|
|
|
|
struct Content;
|
|
|
|
} // namespace View
|
|
|
|
} // namespace Export
|
|
|
|
|
2016-04-12 21:31:28 +00:00
|
|
|
namespace Ui {
|
2017-11-12 15:41:00 +00:00
|
|
|
class ResizeArea;
|
2016-10-12 19:34:25 +00:00
|
|
|
class PlainShadow;
|
2016-10-26 16:43:13 +00:00
|
|
|
class DropdownMenu;
|
2017-04-25 20:36:04 +00:00
|
|
|
template <typename Widget>
|
2017-09-13 16:57:44 +00:00
|
|
|
class SlideWrap;
|
2016-04-12 21:31:28 +00:00
|
|
|
} // namespace Ui
|
|
|
|
|
|
|
|
namespace Window {
|
2019-06-06 10:21:40 +00:00
|
|
|
class SessionController;
|
2018-06-20 00:02:36 +00:00
|
|
|
template <typename Inner>
|
|
|
|
class TopBarWrapWidget;
|
2016-05-19 12:03:51 +00:00
|
|
|
class SectionMemento;
|
|
|
|
class SectionWidget;
|
2017-05-24 10:04:29 +00:00
|
|
|
class AbstractSectionWidget;
|
2019-02-10 16:29:55 +00:00
|
|
|
class ConnectionState;
|
2016-05-19 12:03:51 +00:00
|
|
|
struct SectionSlideParams;
|
2017-10-03 13:05:58 +00:00
|
|
|
struct SectionShow;
|
2017-05-24 10:04:29 +00:00
|
|
|
enum class Column;
|
2018-11-26 14:01:29 +00:00
|
|
|
class HistoryHider;
|
2016-04-12 21:31:28 +00:00
|
|
|
} // namespace Window
|
|
|
|
|
2017-04-25 20:36:04 +00:00
|
|
|
namespace Calls {
|
|
|
|
class Call;
|
|
|
|
class TopBar;
|
|
|
|
} // namespace Calls
|
|
|
|
|
2016-04-04 21:09:46 +00:00
|
|
|
namespace InlineBots {
|
|
|
|
namespace Layout {
|
|
|
|
class ItemBase;
|
|
|
|
} // namespace Layout
|
|
|
|
} // namespace InlineBots
|
|
|
|
|
2018-11-05 11:16:09 +00:00
|
|
|
class MainWidget
|
|
|
|
: public Ui::RpWidget
|
|
|
|
, public RPCSender
|
|
|
|
, private base::Subscriber
|
|
|
|
, private Media::Player::FloatDelegate {
|
2014-05-30 08:53:19 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2017-10-03 13:05:58 +00:00
|
|
|
using SectionShow = Window::SectionShow;
|
|
|
|
|
2019-06-06 10:21:40 +00:00
|
|
|
MainWidget(QWidget *parent, not_null<Window::SessionController*> controller);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2019-08-16 12:44:20 +00:00
|
|
|
[[nodiscard]] Main::Session &session() const;
|
2019-01-18 12:27:37 +00:00
|
|
|
|
2019-08-16 12:44:20 +00:00
|
|
|
[[nodiscard]] bool isMainSectionShown() const;
|
|
|
|
[[nodiscard]] bool isThirdSectionShown() const;
|
2014-12-12 16:27:03 +00:00
|
|
|
|
2019-08-16 12:44:20 +00:00
|
|
|
[[nodiscard]] int contentScrollAddToY() const;
|
|
|
|
|
|
|
|
void returnTabbedSelector();
|
2015-07-03 08:47:16 +00:00
|
|
|
|
2016-12-05 11:01:08 +00:00
|
|
|
void showAnimated(const QPixmap &bgAnimCache, bool back = false);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2018-09-11 12:50:40 +00:00
|
|
|
void start();
|
2015-05-19 15:46:45 +00:00
|
|
|
|
2018-07-09 18:13:48 +00:00
|
|
|
void openPeerByName(
|
|
|
|
const QString &name,
|
|
|
|
MsgId msgId = ShowAtUnreadMsgId,
|
|
|
|
const QString &startToken = QString(),
|
|
|
|
FullMsgId clickFromMessageId = FullMsgId());
|
2015-05-19 15:46:45 +00:00
|
|
|
|
2014-12-12 16:27:03 +00:00
|
|
|
bool started();
|
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();
|
|
|
|
|
2019-04-16 14:05:56 +00:00
|
|
|
void refreshDialog(Dialogs::Key key);
|
2018-01-05 15:57:18 +00:00
|
|
|
void removeDialog(Dialogs::Key key);
|
2020-02-07 09:43:12 +00:00
|
|
|
void repaintDialogRow(FilterId filterId, not_null<Dialogs::Row*> row);
|
2018-12-30 09:16:50 +00:00
|
|
|
void repaintDialogRow(Dialogs::RowDescriptor row);
|
2020-05-12 16:28:44 +00:00
|
|
|
void refreshDialogRow(Dialogs::RowDescriptor row);
|
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);
|
2014-05-30 08:53:19 +00:00
|
|
|
void historyToDown(History *hist);
|
|
|
|
void dialogsToUp();
|
2020-02-11 11:23:51 +00:00
|
|
|
void checkHistoryActivation();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2018-01-04 17:15:04 +00:00
|
|
|
PeerData *peer();
|
2015-07-17 19:17:37 +00:00
|
|
|
|
2017-03-27 12:24:38 +00:00
|
|
|
int backgroundFromY() const;
|
2017-09-16 16:53:41 +00:00
|
|
|
void showSection(
|
|
|
|
Window::SectionMemento &&memento,
|
2017-10-03 13:05:58 +00:00
|
|
|
const SectionShow ¶ms);
|
2017-09-16 16:53:41 +00:00
|
|
|
void updateColumnLayout();
|
2016-07-05 14:48:36 +00:00
|
|
|
bool stackIsEmpty() const;
|
2017-09-20 10:23:57 +00:00
|
|
|
void showBackFromStack(
|
2017-10-03 13:05:58 +00:00
|
|
|
const SectionShow ¶ms);
|
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);
|
2017-09-16 16:53:41 +00:00
|
|
|
void checkMainSectionToLayer();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2019-04-02 10:38:53 +00:00
|
|
|
void onSendFileConfirm(
|
|
|
|
const std::shared_ptr<FileLoadResult> &file,
|
|
|
|
const std::optional<FullMsgId> &oldId);
|
2016-09-11 08:38:14 +00:00
|
|
|
bool onSendSticker(DocumentData *sticker);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
void updateOnlineDisplayIn(int32 msecs);
|
|
|
|
|
|
|
|
bool isActive() const;
|
2020-02-11 11:23:51 +00:00
|
|
|
[[nodiscard]] bool doWeMarkAsRead() const;
|
2015-01-26 13:04:41 +00:00
|
|
|
bool lastWasOnline() const;
|
2019-02-19 06:57:53 +00:00
|
|
|
crl::time 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;
|
|
|
|
|
2017-12-06 10:13:38 +00:00
|
|
|
void showForwardLayer(MessageIdsList &&items);
|
2017-07-11 10:23:15 +00:00
|
|
|
void showSendPathsLayer();
|
2018-01-11 13:07:29 +00:00
|
|
|
void cancelUploadLayer(not_null<HistoryItem*> item);
|
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);
|
2018-11-26 14:01:29 +00:00
|
|
|
void hiderLayer(base::unique_qptr<Window::HistoryHider> h);
|
2017-12-06 10:13:38 +00:00
|
|
|
bool setForwardDraft(PeerId peer, MessageIdsList &&items);
|
2017-11-30 17:45:36 +00:00
|
|
|
bool shareUrl(
|
2018-11-26 14:01:29 +00:00
|
|
|
PeerId peerId,
|
2017-11-30 17:45:36 +00:00
|
|
|
const QString &url,
|
|
|
|
const QString &text);
|
2017-12-30 08:15:42 +00:00
|
|
|
void replyToItem(not_null<HistoryItem*> item);
|
2018-11-26 14:01:29 +00:00
|
|
|
bool inlineSwitchChosen(PeerId peerId, const QString &botAndQuery);
|
|
|
|
bool sendPaths(PeerId peerId);
|
2015-06-27 13:02:00 +00:00
|
|
|
void onFilesOrForwardDrop(const PeerId &peer, const QMimeData *data);
|
2018-11-26 14:01:29 +00:00
|
|
|
bool selectingPeer() const;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-06-14 16:26:41 +00:00
|
|
|
void deletePhotoLayer(PhotoData *photo);
|
|
|
|
|
2018-03-08 21:21:27 +00:00
|
|
|
// While HistoryInner is not HistoryView::ListWidget.
|
2019-02-19 06:57:53 +00:00
|
|
|
crl::time highlightStartTime(not_null<const HistoryItem*> item) const;
|
2014-07-04 11:12:54 +00:00
|
|
|
|
2019-02-17 11:43:46 +00:00
|
|
|
MsgId currentReplyToIdFor(not_null<History*> history) const;
|
|
|
|
|
2016-04-14 19:24:42 +00:00
|
|
|
void sendBotCommand(PeerData *peer, UserData *bot, const QString &cmd, MsgId replyTo);
|
2016-11-20 12:54:07 +00:00
|
|
|
void hideSingleUseKeyboard(PeerData *peer, MsgId replyTo);
|
2017-03-27 18:11:51 +00:00
|
|
|
bool insertBotCommand(const QString &cmd);
|
2015-06-10 15:54:24 +00:00
|
|
|
|
2018-02-14 19:38:01 +00:00
|
|
|
void searchMessages(const QString &query, Dialogs::Key inChat);
|
2018-01-19 17:10:58 +00:00
|
|
|
void itemEdited(not_null<HistoryItem*> item);
|
2014-08-15 11:19:32 +00:00
|
|
|
|
2014-11-12 20:30:26 +00:00
|
|
|
void checkLastUpdate(bool afterSleep);
|
|
|
|
|
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 updateScrollColors();
|
|
|
|
|
2019-01-17 08:18:23 +00:00
|
|
|
void setChatBackground(
|
|
|
|
const Data::WallPaper &background,
|
|
|
|
QImage &&image = QImage());
|
2015-02-03 15:02:46 +00:00
|
|
|
bool chatBackgroundLoading();
|
2016-06-22 13:39:54 +00:00
|
|
|
float64 chatBackgroundProgress() const;
|
2015-02-03 15:02:46 +00:00
|
|
|
void checkChatBackground();
|
2019-01-25 14:37:28 +00:00
|
|
|
Image *newBackgroundThumb();
|
2015-03-19 09:18:19 +00:00
|
|
|
|
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
|
|
|
|
2018-01-11 13:07:29 +00:00
|
|
|
void pushReplyReturn(not_null<HistoryItem*> item);
|
2015-12-31 15:27:21 +00:00
|
|
|
|
2017-12-08 11:52:12 +00:00
|
|
|
void cancelForwarding(not_null<History*> history);
|
2019-08-12 12:11:34 +00:00
|
|
|
void finishForwarding(Api::SendAction action);
|
2015-03-24 10:00:27 +00:00
|
|
|
|
2018-01-07 12:04:34 +00:00
|
|
|
// Does offerPeer or showPeerHistory.
|
|
|
|
void choosePeer(PeerId peerId, MsgId showAtMsgId);
|
2015-07-17 19:17:37 +00:00
|
|
|
void clearBotStartToken(PeerData *peer);
|
|
|
|
|
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
|
|
|
|
2015-09-16 13:04:08 +00:00
|
|
|
void ctrlEnterSubmitUpdated();
|
|
|
|
void setInnerFocus();
|
|
|
|
|
2015-09-21 20:57:42 +00:00
|
|
|
void scheduleViewIncrement(HistoryItem *item);
|
|
|
|
|
2018-01-31 17:10:29 +00:00
|
|
|
void feedChannelDifference(const MTPDupdates_channelDifference &data);
|
2015-09-21 20:57:42 +00:00
|
|
|
|
2019-01-18 11:26:43 +00:00
|
|
|
// Made public for ApiWrap, while it is still here.
|
2017-07-14 11:54:47 +00:00
|
|
|
// Better would be for this to be moved to ApiWrap.
|
|
|
|
bool requestingDifference() const {
|
|
|
|
return _ptsWaiter.requesting();
|
|
|
|
}
|
2019-01-18 11:26:43 +00:00
|
|
|
void getDifference();
|
|
|
|
void updateOnline(bool gotOtherOffline = false);
|
|
|
|
void checkIdleFinish();
|
2017-07-14 11:54:47 +00:00
|
|
|
|
2015-10-01 14:05:05 +00:00
|
|
|
bool contentOverlapped(const QRect &globalRect);
|
|
|
|
|
2017-11-21 16:38:17 +00:00
|
|
|
bool ptsUpdateAndApply(int32 pts, int32 ptsCount, const MTPUpdates &updates);
|
|
|
|
bool ptsUpdateAndApply(int32 pts, int32 ptsCount, const MTPUpdate &update);
|
|
|
|
bool ptsUpdateAndApply(int32 pts, int32 ptsCount);
|
|
|
|
|
2018-01-22 17:39:20 +00:00
|
|
|
void searchInChat(Dialogs::Key chat);
|
|
|
|
|
2017-12-18 15:44:50 +00:00
|
|
|
void app_sendBotCallback(
|
|
|
|
not_null<const HistoryMessageMarkupButton*> button,
|
|
|
|
not_null<const HistoryItem*> msg,
|
|
|
|
int row,
|
|
|
|
int column);
|
2016-04-06 17:02:22 +00:00
|
|
|
|
2017-09-20 10:23:57 +00:00
|
|
|
void ui_showPeerHistory(
|
|
|
|
PeerId peer,
|
2017-10-03 13:05:58 +00:00
|
|
|
const SectionShow ¶ms,
|
|
|
|
MsgId msgId);
|
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);
|
2015-12-07 13:05:00 +00:00
|
|
|
|
2019-04-30 18:31:42 +00:00
|
|
|
void closeBothPlayers();
|
|
|
|
|
2019-01-31 20:36:15 +00:00
|
|
|
bool isQuitPrevent();
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
~MainWidget();
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void dialogsUpdated();
|
|
|
|
|
|
|
|
public slots:
|
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();
|
|
|
|
|
2016-09-23 16:04:26 +00:00
|
|
|
protected:
|
|
|
|
void paintEvent(QPaintEvent *e) override;
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
|
|
|
void keyPressEvent(QKeyEvent *e) override;
|
2017-01-14 18:50:16 +00:00
|
|
|
bool eventFilter(QObject *o, QEvent *e) override;
|
2016-09-23 16:04:26 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
private:
|
2019-02-19 06:57:53 +00:00
|
|
|
using ChannelGetDifferenceTime = QMap<ChannelData*, crl::time>;
|
2017-05-22 15:25:49 +00:00
|
|
|
enum class ChannelDifferenceRequest {
|
|
|
|
Unknown,
|
|
|
|
PtsGapOrShortPoll,
|
|
|
|
AfterFail,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct DeleteHistoryRequest {
|
|
|
|
PeerData *peer;
|
|
|
|
bool justClearHistory;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct DeleteAllFromUserParams {
|
|
|
|
ChannelData *channel;
|
|
|
|
UserData *from;
|
|
|
|
};
|
|
|
|
|
2019-01-18 11:26:43 +00:00
|
|
|
void viewsIncrement();
|
|
|
|
void sendPing();
|
|
|
|
void getDifferenceByPts();
|
|
|
|
void getDifferenceAfterFail();
|
|
|
|
|
2016-12-05 11:01:08 +00:00
|
|
|
void animationCallback();
|
2017-01-14 18:50:16 +00:00
|
|
|
void handleAdaptiveLayoutUpdate();
|
|
|
|
void updateWindowAdaptiveLayout();
|
2019-03-04 11:28:52 +00:00
|
|
|
void handleAudioUpdate(const Media::Player::TrackState &state);
|
2016-09-23 16:04:26 +00:00
|
|
|
void updateMediaPlayerPosition();
|
2016-10-14 17:10:15 +00:00
|
|
|
void updateMediaPlaylistPosition(int x);
|
2016-10-12 19:34:25 +00:00
|
|
|
void updateControlsGeometry();
|
2017-01-14 18:50:16 +00:00
|
|
|
void updateDialogsWidthAnimated();
|
2018-01-22 16:42:25 +00:00
|
|
|
void updateThirdColumnToCurrentChat(
|
|
|
|
Dialogs::Key key,
|
2017-09-20 18:40:23 +00:00
|
|
|
bool canWrite);
|
2017-11-28 20:01:00 +00:00
|
|
|
[[nodiscard]] bool saveThirdSectionToStackBack() const;
|
2018-01-22 16:42:25 +00:00
|
|
|
[[nodiscard]] auto thirdSectionForCurrentMainSection(Dialogs::Key key)
|
|
|
|
-> std::unique_ptr<Window::SectionMemento>;
|
2018-01-04 09:21:06 +00:00
|
|
|
void userIsContactUpdated(not_null<UserData*> user);
|
2016-10-12 19:34:25 +00:00
|
|
|
|
2018-05-07 17:44:33 +00:00
|
|
|
void setupConnectingWidget();
|
2016-10-12 19:34:25 +00:00
|
|
|
void createPlayer();
|
|
|
|
void playerHeightUpdated();
|
2016-08-27 04:49:18 +00:00
|
|
|
|
2017-04-25 20:36:04 +00:00
|
|
|
void setCurrentCall(Calls::Call *call);
|
|
|
|
void createCallTopBar();
|
|
|
|
void destroyCallTopBar();
|
2017-09-13 16:57:44 +00:00
|
|
|
void callTopBarHeightUpdated(int callTopBarHeight);
|
2017-04-25 20:36:04 +00:00
|
|
|
|
2018-06-20 00:02:36 +00:00
|
|
|
void setCurrentExportView(Export::View::PanelController *view);
|
|
|
|
void createExportTopBar(Export::View::Content &&data);
|
|
|
|
void destroyExportTopBar();
|
|
|
|
void exportTopBarHeightUpdated();
|
|
|
|
|
2017-09-16 16:53:41 +00:00
|
|
|
Window::SectionSlideParams prepareShowAnimation(
|
|
|
|
bool willHaveTopBarShadow);
|
|
|
|
void showNewSection(
|
|
|
|
Window::SectionMemento &&memento,
|
2017-10-03 13:05:58 +00:00
|
|
|
const SectionShow ¶ms);
|
2017-09-16 16:53:41 +00:00
|
|
|
void dropMainSection(Window::SectionWidget *widget);
|
|
|
|
|
|
|
|
Window::SectionSlideParams prepareThirdSectionAnimation(Window::SectionWidget *section);
|
2016-05-19 12:03:51 +00:00
|
|
|
|
|
|
|
// All this methods use the prepareShowAnimation().
|
2017-09-16 16:53:41 +00:00
|
|
|
Window::SectionSlideParams prepareMainSectionAnimation(Window::SectionWidget *section);
|
2016-05-19 12:03:51 +00:00
|
|
|
Window::SectionSlideParams prepareHistoryAnimation(PeerId historyPeerId);
|
|
|
|
Window::SectionSlideParams prepareDialogsAnimation();
|
|
|
|
|
2016-07-05 14:48:36 +00:00
|
|
|
void saveSectionInStack();
|
|
|
|
|
2016-10-23 21:03:10 +00:00
|
|
|
void getChannelDifference(ChannelData *channel, ChannelDifferenceRequest from = ChannelDifferenceRequest::Unknown);
|
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
|
|
|
|
2019-11-22 09:40:52 +00:00
|
|
|
void mtpUpdateReceived(const MTPUpdates &updates);
|
|
|
|
void mtpNewSessionCreated();
|
2018-01-18 09:53:49 +00:00
|
|
|
void feedUpdateVector(
|
|
|
|
const MTPVector<MTPUpdate> &updates,
|
|
|
|
bool skipMessageIds = false);
|
|
|
|
// Doesn't call sendHistoryChangeNotifications itself.
|
2014-05-30 08:53:19 +00:00
|
|
|
void feedMessageIds(const MTPVector<MTPUpdate> &updates);
|
2018-01-18 09:53:49 +00:00
|
|
|
// Doesn't call sendHistoryChangeNotifications itself.
|
|
|
|
void feedUpdate(const MTPUpdate &update);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
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
|
|
|
|
2017-09-16 16:53:41 +00:00
|
|
|
int getMainSectionTop() const;
|
|
|
|
int getThirdSectionTop() const;
|
2017-04-25 20:36:04 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
void hideAll();
|
|
|
|
void showAll();
|
2018-11-26 14:01:29 +00:00
|
|
|
void clearHider(not_null<Window::HistoryHider*> instance);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2019-01-18 11:26:43 +00:00
|
|
|
void cacheBackground();
|
2016-08-27 04:49:18 +00:00
|
|
|
void clearCachedBackground();
|
2018-11-05 11:16:09 +00:00
|
|
|
|
|
|
|
not_null<Media::Player::FloatDelegate*> floatPlayerDelegate();
|
|
|
|
not_null<Ui::RpWidget*> floatPlayerWidget() override;
|
2019-06-06 10:21:40 +00:00
|
|
|
not_null<Window::SessionController*> floatPlayerController() override;
|
2018-11-05 11:16:09 +00:00
|
|
|
not_null<Window::AbstractSectionWidget*> floatPlayerGetSection(
|
|
|
|
Window::Column column) override;
|
|
|
|
void floatPlayerEnumerateSections(Fn<void(
|
|
|
|
not_null<Window::AbstractSectionWidget*> widget,
|
|
|
|
Window::Column widgetColumn)> callback) override;
|
2018-11-05 13:18:54 +00:00
|
|
|
bool floatPlayerIsVisible(not_null<HistoryItem*> item) override;
|
|
|
|
void floatPlayerClosed(FullMsgId itemId);
|
2017-05-22 15:25:49 +00:00
|
|
|
|
2019-02-19 06:57:53 +00:00
|
|
|
bool getDifferenceTimeChanged(ChannelData *channel, int32 ms, ChannelGetDifferenceTime &channelCurTime, crl::time &curTime);
|
2017-05-22 15:25:49 +00:00
|
|
|
|
|
|
|
void viewsIncrementDone(QVector<MTPint> ids, const MTPVector<MTPint> &result, mtpRequestId req);
|
|
|
|
bool viewsIncrementFail(const RPCError &error, mtpRequestId req);
|
|
|
|
|
2019-01-31 20:36:15 +00:00
|
|
|
void updateStatusDone(const MTPBool &result);
|
|
|
|
bool updateStatusFail(const RPCError &error);
|
|
|
|
|
2017-11-12 15:41:00 +00:00
|
|
|
void refreshResizeAreas();
|
|
|
|
template <typename MoveCallback, typename FinishCallback>
|
|
|
|
void createResizeArea(
|
|
|
|
object_ptr<Ui::ResizeArea> &area,
|
|
|
|
MoveCallback &&moveCallback,
|
|
|
|
FinishCallback &&finishCallback);
|
|
|
|
void ensureFirstColumnResizeAreaCreated();
|
|
|
|
void ensureThirdColumnResizeAreaCreated();
|
|
|
|
|
2019-01-17 08:18:23 +00:00
|
|
|
bool isReadyChatBackground(
|
|
|
|
const Data::WallPaper &background,
|
|
|
|
const QImage &image) const;
|
|
|
|
void setReadyChatBackground(
|
|
|
|
const Data::WallPaper &background,
|
|
|
|
QImage &&image);
|
2019-01-16 12:39:35 +00:00
|
|
|
|
2019-05-12 12:59:01 +00:00
|
|
|
void handleHistoryBack();
|
|
|
|
|
2019-06-06 10:21:40 +00:00
|
|
|
not_null<Window::SessionController*> _controller;
|
2017-05-22 15:25:49 +00:00
|
|
|
bool _started = false;
|
|
|
|
|
2019-04-02 09:13:30 +00:00
|
|
|
Ui::Animations::Simple _a_show;
|
2016-12-05 11:01:08 +00:00
|
|
|
bool _showBack = false;
|
2015-10-17 14:52:26 +00:00
|
|
|
QPixmap _cacheUnder, _cacheOver;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2017-11-12 16:50:58 +00:00
|
|
|
int _dialogsWidth = 0;
|
|
|
|
int _thirdColumnWidth = 0;
|
2019-04-02 09:13:30 +00:00
|
|
|
Ui::Animations::Simple _a_dialogsWidth;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::PlainShadow> _sideShadow;
|
2017-09-16 16:53:41 +00:00
|
|
|
object_ptr<Ui::PlainShadow> _thirdShadow = { nullptr };
|
2017-11-12 15:41:00 +00:00
|
|
|
object_ptr<Ui::ResizeArea> _firstColumnResizeArea = { nullptr };
|
|
|
|
object_ptr<Ui::ResizeArea> _thirdColumnResizeArea = { nullptr };
|
2019-04-24 10:15:10 +00:00
|
|
|
object_ptr<Dialogs::Widget> _dialogs;
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<HistoryWidget> _history;
|
2017-09-16 16:53:41 +00:00
|
|
|
object_ptr<Window::SectionWidget> _mainSection = { nullptr };
|
2017-04-07 18:10:49 +00:00
|
|
|
object_ptr<Window::SectionWidget> _thirdSection = { nullptr };
|
2017-11-28 20:01:00 +00:00
|
|
|
std::unique_ptr<Window::SectionMemento> _thirdSectionFromStack;
|
2019-02-10 16:29:55 +00:00
|
|
|
std::unique_ptr<Window::ConnectionState> _connecting;
|
2016-12-13 17:07:56 +00:00
|
|
|
|
2017-11-30 17:33:27 +00:00
|
|
|
base::weak_ptr<Calls::Call> _currentCall;
|
2017-09-13 16:57:44 +00:00
|
|
|
object_ptr<Ui::SlideWrap<Calls::TopBar>> _callTopBar = { nullptr };
|
2017-04-25 20:36:04 +00:00
|
|
|
|
2018-06-20 00:02:36 +00:00
|
|
|
Export::View::PanelController *_currentExportView = nullptr;
|
|
|
|
object_ptr<Window::TopBarWrapWidget<Export::View::TopBar>> _exportTopBar
|
|
|
|
= { nullptr };
|
|
|
|
|
|
|
|
object_ptr<Window::TopBarWrapWidget<Media::Player::Widget>> _player
|
|
|
|
= { nullptr };
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Media::Player::VolumeWidget> _playerVolume = { nullptr };
|
|
|
|
object_ptr<Media::Player::Panel> _playerPlaylist;
|
2016-10-14 17:10:15 +00:00
|
|
|
bool _playerUsingPanel = false;
|
|
|
|
|
2018-11-26 14:01:29 +00:00
|
|
|
base::unique_qptr<Window::HistoryHider> _hider;
|
2017-02-21 13:45:56 +00:00
|
|
|
std::vector<std::unique_ptr<StackItem>> _stack;
|
2015-12-07 10:06:59 +00:00
|
|
|
|
2016-04-08 09:20:10 +00:00
|
|
|
int _playerHeight = 0;
|
2017-04-25 20:36:04 +00:00
|
|
|
int _callTopBarHeight = 0;
|
2018-06-20 00:02:36 +00:00
|
|
|
int _exportTopBarHeight = 0;
|
2016-04-08 09:20:10 +00:00
|
|
|
int _contentScrollAddToY = 0;
|
2015-07-03 08:47:16 +00:00
|
|
|
|
2016-04-08 09:20:10 +00:00
|
|
|
int32 updDate = 0;
|
|
|
|
int32 updQts = -1;
|
|
|
|
int32 updSeq = 0;
|
2019-01-18 11:26:43 +00:00
|
|
|
base::Timer _noUpdatesTimer;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-09-13 08:41:27 +00:00
|
|
|
PtsWaiter _ptsWaiter;
|
|
|
|
|
|
|
|
ChannelGetDifferenceTime _channelGetDifferenceTimeByPts, _channelGetDifferenceTimeAfterFail;
|
2019-02-19 06:57:53 +00:00
|
|
|
crl::time _getDifferenceTimeByPts = 0;
|
|
|
|
crl::time _getDifferenceTimeAfterFail = 0;
|
2015-09-13 08:41:27 +00:00
|
|
|
|
2019-01-18 11:26:43 +00:00
|
|
|
base::Timer _byPtsTimer;
|
2015-09-13 08:41:27 +00:00
|
|
|
|
|
|
|
QMap<int32, MTPUpdates> _bySeqUpdates;
|
2019-01-18 11:26:43 +00:00
|
|
|
base::Timer _bySeqTimer;
|
2015-09-13 08:41:27 +00:00
|
|
|
|
2019-01-18 11:26:43 +00:00
|
|
|
base::Timer _byMinChannelTimer;
|
2016-03-11 15:01:32 +00:00
|
|
|
|
2016-04-08 09:20:10 +00:00
|
|
|
mtpRequestId _onlineRequest = 0;
|
2019-01-18 11:26:43 +00:00
|
|
|
base::Timer _onlineTimer;
|
|
|
|
base::Timer _idleFinishTimer;
|
2016-04-08 09:20:10 +00:00
|
|
|
bool _lastWasOnline = false;
|
2019-02-19 06:57:53 +00:00
|
|
|
crl::time _lastSetOnline = 0;
|
2016-04-08 09:20:10 +00:00
|
|
|
bool _isIdle = false;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-04-08 09:20:10 +00:00
|
|
|
int32 _failDifferenceTimeout = 1; // growing timeout for getDifference calls, if it fails
|
2019-01-16 12:25:29 +00:00
|
|
|
QMap<ChannelData*, int32> _channelFailDifferenceTimeout; // growing timeout for getChannelDifference calls, if it fails
|
2019-01-18 11:26:43 +00:00
|
|
|
base::Timer _failDifferenceTimer;
|
2014-11-12 20:30:26 +00:00
|
|
|
|
2019-02-19 06:57:53 +00:00
|
|
|
crl::time _lastUpdateTime = 0;
|
2016-04-08 09:20:10 +00:00
|
|
|
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;
|
2019-01-18 11:26:43 +00:00
|
|
|
base::Timer _cacheBackgroundTimer;
|
2015-02-03 15:02:46 +00:00
|
|
|
|
2016-06-14 16:26:41 +00:00
|
|
|
PhotoData *_deletingPhoto = nullptr;
|
|
|
|
|
2019-01-16 12:25:29 +00:00
|
|
|
using ViewsIncrementMap = QMap<MsgId, bool>;
|
|
|
|
QMap<PeerData*, ViewsIncrementMap> _viewsIncremented, _viewsToIncrement;
|
|
|
|
QMap<PeerData*, mtpRequestId> _viewsIncrementRequests;
|
|
|
|
QMap<mtpRequestId, PeerData*> _viewsIncrementByRequest;
|
2019-01-18 11:26:43 +00:00
|
|
|
base::Timer _viewsIncrementTimer;
|
2015-09-21 20:57:42 +00:00
|
|
|
|
2019-01-16 12:39:35 +00:00
|
|
|
struct SettingBackground;
|
|
|
|
std::unique_ptr<SettingBackground> _background;
|
2015-02-03 15:02:46 +00:00
|
|
|
|
2017-11-12 15:41:00 +00:00
|
|
|
bool _firstColumnResizing = false;
|
|
|
|
int _firstColumnResizingShift = 0;
|
2017-01-14 18:50:16 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
};
|
2019-09-13 06:06:02 +00:00
|
|
|
|
|
|
|
namespace App {
|
|
|
|
MainWidget *main();
|
|
|
|
} // namespace App
|