2017-03-27 12:24:38 +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.
|
2017-03-27 12:24:38 +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
|
2017-03-27 12:24:38 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2017-08-31 16:28:58 +00:00
|
|
|
#include "base/flags.h"
|
2019-09-13 12:22:54 +00:00
|
|
|
#include "base/object_ptr.h"
|
2020-06-10 18:08:17 +00:00
|
|
|
#include "base/weak_ptr.h"
|
2020-07-01 14:19:25 +00:00
|
|
|
#include "base/timer.h"
|
2018-01-22 16:42:25 +00:00
|
|
|
#include "dialogs/dialogs_key.h"
|
2021-08-13 18:18:06 +00:00
|
|
|
#include "ui/effects/animations.h"
|
2021-06-13 07:37:52 +00:00
|
|
|
#include "ui/layers/layer_widget.h"
|
2021-05-26 23:20:27 +00:00
|
|
|
#include "window/window_adaptive.h"
|
2017-08-31 16:28:58 +00:00
|
|
|
|
2020-06-23 17:21:58 +00:00
|
|
|
class PhotoData;
|
2017-09-15 17:34:41 +00:00
|
|
|
class MainWidget;
|
2019-08-16 12:44:20 +00:00
|
|
|
class MainWindow;
|
2018-01-11 19:33:26 +00:00
|
|
|
class HistoryMessage;
|
|
|
|
class HistoryService;
|
|
|
|
|
2019-09-13 06:06:02 +00:00
|
|
|
namespace Adaptive {
|
|
|
|
enum class WindowLayout;
|
|
|
|
} // namespace Adaptive
|
|
|
|
|
2019-08-16 12:44:20 +00:00
|
|
|
namespace ChatHelpers {
|
|
|
|
class TabbedSelector;
|
|
|
|
} // namespace ChatHelpers
|
|
|
|
|
2019-07-24 11:45:24 +00:00
|
|
|
namespace Main {
|
|
|
|
class Session;
|
|
|
|
} // namespace Main
|
|
|
|
|
2018-09-05 19:05:49 +00:00
|
|
|
namespace Settings {
|
|
|
|
enum class Type;
|
|
|
|
} // namespace Settings
|
|
|
|
|
2018-03-18 08:51:14 +00:00
|
|
|
namespace Passport {
|
|
|
|
struct FormRequest;
|
|
|
|
class FormController;
|
|
|
|
} // namespace Passport
|
|
|
|
|
2019-09-18 11:19:05 +00:00
|
|
|
namespace Ui {
|
|
|
|
class LayerWidget;
|
2021-02-15 17:37:22 +00:00
|
|
|
enum class ReportReason;
|
2019-09-18 11:19:05 +00:00
|
|
|
} // namespace Ui
|
|
|
|
|
2017-03-27 12:24:38 +00:00
|
|
|
namespace Window {
|
|
|
|
|
2017-12-04 07:33:33 +00:00
|
|
|
class MainWindow;
|
|
|
|
class SectionMemento;
|
2019-09-03 15:24:51 +00:00
|
|
|
class Controller;
|
2020-03-03 12:07:22 +00:00
|
|
|
class FiltersMenu;
|
2017-10-13 17:35:29 +00:00
|
|
|
|
2021-08-13 15:39:50 +00:00
|
|
|
struct CachedBackground {
|
|
|
|
QPixmap pixmap;
|
2021-08-13 17:19:06 +00:00
|
|
|
QSize area;
|
2021-08-13 15:39:50 +00:00
|
|
|
int x = 0;
|
|
|
|
int y = 0;
|
|
|
|
};
|
|
|
|
|
2021-08-13 18:18:06 +00:00
|
|
|
struct BackgroundState {
|
|
|
|
CachedBackground was;
|
|
|
|
CachedBackground now;
|
|
|
|
float64 shown = 1.;
|
|
|
|
};
|
|
|
|
|
2017-04-07 18:10:49 +00:00
|
|
|
enum class GifPauseReason {
|
2017-09-03 18:36:06 +00:00
|
|
|
Any = 0,
|
2017-04-07 18:10:49 +00:00
|
|
|
InlineResults = (1 << 0),
|
2017-09-03 18:36:06 +00:00
|
|
|
SavedGifs = (1 << 1),
|
|
|
|
Layer = (1 << 2),
|
|
|
|
RoundPlaying = (1 << 3),
|
|
|
|
MediaPreview = (1 << 4),
|
2017-04-07 18:10:49 +00:00
|
|
|
};
|
2017-08-31 16:28:58 +00:00
|
|
|
using GifPauseReasons = base::flags<GifPauseReason>;
|
|
|
|
inline constexpr bool is_flag_type(GifPauseReason) { return true; };
|
2017-04-07 18:10:49 +00:00
|
|
|
|
2018-02-21 21:17:36 +00:00
|
|
|
class DateClickHandler : public ClickHandler {
|
|
|
|
public:
|
|
|
|
DateClickHandler(Dialogs::Key chat, QDate date);
|
|
|
|
|
|
|
|
void setDate(QDate date);
|
2018-07-09 18:13:48 +00:00
|
|
|
void onClick(ClickContext context) const override;
|
2018-02-21 21:17:36 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
Dialogs::Key _chat;
|
|
|
|
QDate _date;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2017-10-03 13:05:58 +00:00
|
|
|
struct SectionShow {
|
|
|
|
enum class Way {
|
|
|
|
Forward,
|
|
|
|
Backward,
|
|
|
|
ClearStack,
|
|
|
|
};
|
2020-08-31 11:17:02 +00:00
|
|
|
|
|
|
|
struct OriginMessage {
|
|
|
|
FullMsgId id;
|
|
|
|
};
|
|
|
|
using Origin = std::variant<v::null_t, OriginMessage>;
|
|
|
|
|
2017-10-03 13:05:58 +00:00
|
|
|
SectionShow(
|
2017-10-03 17:41:44 +00:00
|
|
|
Way way = Way::Forward,
|
2017-10-03 13:05:58 +00:00
|
|
|
anim::type animated = anim::type::normal,
|
|
|
|
anim::activation activation = anim::activation::normal)
|
|
|
|
: way(way)
|
|
|
|
, animated(animated)
|
|
|
|
, activation(activation) {
|
|
|
|
}
|
|
|
|
SectionShow(
|
|
|
|
anim::type animated,
|
|
|
|
anim::activation activation = anim::activation::normal)
|
|
|
|
: animated(animated)
|
|
|
|
, activation(activation) {
|
|
|
|
}
|
|
|
|
|
|
|
|
SectionShow withWay(Way newWay) const {
|
|
|
|
return SectionShow(newWay, animated, activation);
|
|
|
|
}
|
2017-12-04 07:33:33 +00:00
|
|
|
SectionShow withThirdColumn() const {
|
|
|
|
auto copy = *this;
|
|
|
|
copy.thirdColumn = true;
|
|
|
|
return copy;
|
|
|
|
}
|
2017-10-03 13:05:58 +00:00
|
|
|
|
|
|
|
Way way = Way::Forward;
|
|
|
|
anim::type animated = anim::type::normal;
|
|
|
|
anim::activation activation = anim::activation::normal;
|
2017-12-04 07:33:33 +00:00
|
|
|
bool thirdColumn = false;
|
2020-08-31 11:17:02 +00:00
|
|
|
Origin origin;
|
2017-10-03 13:05:58 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2019-06-06 10:21:40 +00:00
|
|
|
class SessionController;
|
2017-12-04 07:33:33 +00:00
|
|
|
|
2020-06-30 14:26:44 +00:00
|
|
|
class SessionNavigation : public base::has_weak_ptr {
|
2017-12-04 07:33:33 +00:00
|
|
|
public:
|
2019-07-24 11:45:24 +00:00
|
|
|
explicit SessionNavigation(not_null<Main::Session*> session);
|
2020-09-03 08:21:31 +00:00
|
|
|
virtual ~SessionNavigation();
|
2019-01-18 12:27:37 +00:00
|
|
|
|
2019-07-24 11:45:24 +00:00
|
|
|
Main::Session &session() const;
|
2019-01-18 12:27:37 +00:00
|
|
|
|
2017-12-04 07:33:33 +00:00
|
|
|
virtual void showSection(
|
2020-12-14 14:48:10 +00:00
|
|
|
std::shared_ptr<SectionMemento> memento,
|
2017-12-04 07:33:33 +00:00
|
|
|
const SectionShow ¶ms = SectionShow()) = 0;
|
|
|
|
virtual void showBackFromStack(
|
|
|
|
const SectionShow ¶ms = SectionShow()) = 0;
|
2019-06-06 10:21:40 +00:00
|
|
|
virtual not_null<SessionController*> parentController() = 0;
|
2017-12-04 07:33:33 +00:00
|
|
|
|
2020-09-22 15:05:07 +00:00
|
|
|
struct CommentId {
|
|
|
|
MsgId id = 0;
|
|
|
|
};
|
|
|
|
struct ThreadId {
|
|
|
|
MsgId id = 0;
|
|
|
|
};
|
|
|
|
using RepliesByLinkInfo = std::variant<v::null_t, CommentId, ThreadId>;
|
|
|
|
struct PeerByLinkInfo {
|
|
|
|
std::variant<QString, ChannelId> usernameOrId;
|
|
|
|
MsgId messageId = ShowAtUnreadMsgId;
|
|
|
|
RepliesByLinkInfo repliesInfo;
|
|
|
|
QString startToken;
|
2021-03-10 20:03:20 +00:00
|
|
|
std::optional<QString> voicechatHash;
|
2020-09-22 15:05:07 +00:00
|
|
|
FullMsgId clickFromMessageId;
|
|
|
|
};
|
|
|
|
void showPeerByLink(const PeerByLinkInfo &info);
|
|
|
|
|
2020-09-03 08:21:31 +00:00
|
|
|
void showRepliesForMessage(
|
|
|
|
not_null<History*> history,
|
|
|
|
MsgId rootId,
|
2020-09-17 17:57:06 +00:00
|
|
|
MsgId commentId = 0,
|
2020-09-03 08:21:31 +00:00
|
|
|
const SectionShow ¶ms = SectionShow());
|
|
|
|
|
2017-12-04 07:33:33 +00:00
|
|
|
void showPeerInfo(
|
|
|
|
PeerId peerId,
|
|
|
|
const SectionShow ¶ms = SectionShow());
|
|
|
|
void showPeerInfo(
|
|
|
|
not_null<PeerData*> peer,
|
|
|
|
const SectionShow ¶ms = SectionShow());
|
|
|
|
void showPeerInfo(
|
|
|
|
not_null<History*> history,
|
|
|
|
const SectionShow ¶ms = SectionShow());
|
|
|
|
|
2020-09-22 15:05:07 +00:00
|
|
|
virtual void showPeerHistory(
|
|
|
|
PeerId peerId,
|
|
|
|
const SectionShow ¶ms = SectionShow::Way::ClearStack,
|
|
|
|
MsgId msgId = ShowAtUnreadMsgId) = 0;
|
|
|
|
void showPeerHistory(
|
|
|
|
not_null<PeerData*> peer,
|
|
|
|
const SectionShow ¶ms = SectionShow::Way::ClearStack,
|
|
|
|
MsgId msgId = ShowAtUnreadMsgId);
|
|
|
|
void showPeerHistory(
|
|
|
|
not_null<History*> history,
|
|
|
|
const SectionShow ¶ms = SectionShow::Way::ClearStack,
|
|
|
|
MsgId msgId = ShowAtUnreadMsgId);
|
|
|
|
|
|
|
|
void clearSectionStack(
|
|
|
|
const SectionShow ¶ms = SectionShow::Way::ClearStack) {
|
|
|
|
showPeerHistory(
|
|
|
|
PeerId(0),
|
|
|
|
params,
|
|
|
|
ShowAtUnreadMsgId);
|
|
|
|
}
|
|
|
|
|
2018-09-05 19:05:49 +00:00
|
|
|
void showSettings(
|
|
|
|
Settings::Type type,
|
|
|
|
const SectionShow ¶ms = SectionShow());
|
|
|
|
void showSettings(const SectionShow ¶ms = SectionShow());
|
|
|
|
|
2020-01-15 11:53:42 +00:00
|
|
|
void showPollResults(
|
|
|
|
not_null<PollData*> poll,
|
|
|
|
FullMsgId contextId,
|
|
|
|
const SectionShow ¶ms = SectionShow());
|
|
|
|
|
2018-01-21 14:49:42 +00:00
|
|
|
|
2019-01-18 12:27:37 +00:00
|
|
|
private:
|
2020-09-22 15:05:07 +00:00
|
|
|
void resolveUsername(
|
|
|
|
const QString &username,
|
|
|
|
Fn<void(not_null<PeerData*>)> done);
|
|
|
|
void resolveChannelById(
|
|
|
|
ChannelId channelId,
|
|
|
|
Fn<void(not_null<ChannelData*>)> done);
|
|
|
|
|
|
|
|
void showPeerByLinkResolved(
|
|
|
|
not_null<PeerData*> peer,
|
|
|
|
const PeerByLinkInfo &info);
|
|
|
|
|
2019-07-24 11:45:24 +00:00
|
|
|
const not_null<Main::Session*> _session;
|
2019-01-18 12:27:37 +00:00
|
|
|
|
2020-09-22 15:05:07 +00:00
|
|
|
mtpRequestId _resolveRequestId = 0;
|
|
|
|
|
2020-09-03 08:21:31 +00:00
|
|
|
History *_showingRepliesHistory = nullptr;
|
|
|
|
MsgId _showingRepliesRootId = 0;
|
|
|
|
mtpRequestId _showingRepliesRequestId = 0;
|
|
|
|
|
2017-12-04 07:33:33 +00:00
|
|
|
};
|
2017-04-07 18:10:49 +00:00
|
|
|
|
2021-05-25 10:35:38 +00:00
|
|
|
class SessionController : public SessionNavigation {
|
2017-03-27 12:24:38 +00:00
|
|
|
public:
|
2019-06-06 10:21:40 +00:00
|
|
|
SessionController(
|
2019-07-24 11:45:24 +00:00
|
|
|
not_null<Main::Session*> session,
|
2019-09-03 15:24:51 +00:00
|
|
|
not_null<Controller*> window);
|
2020-10-29 23:43:35 +00:00
|
|
|
~SessionController();
|
2017-04-07 18:10:49 +00:00
|
|
|
|
2019-09-03 15:24:51 +00:00
|
|
|
[[nodiscard]] Controller &window() const {
|
|
|
|
return *_window;
|
2017-03-27 12:24:38 +00:00
|
|
|
}
|
2019-09-03 15:24:51 +00:00
|
|
|
[[nodiscard]] not_null<::MainWindow*> widget() const;
|
2020-06-10 18:08:17 +00:00
|
|
|
[[nodiscard]] not_null<MainWidget*> content() const;
|
2021-05-27 13:54:24 +00:00
|
|
|
[[nodiscard]] Adaptive &adaptive() const;
|
2017-03-27 12:24:38 +00:00
|
|
|
|
2020-06-30 15:05:12 +00:00
|
|
|
// We need access to this from MainWidget::MainWidget, where
|
|
|
|
// we can't call content() yet.
|
|
|
|
void setSelectingPeer(bool selecting) {
|
|
|
|
_selectingPeer = selecting;
|
|
|
|
}
|
|
|
|
[[nodiscard]] bool selectingPeer() const {
|
|
|
|
return _selectingPeer;
|
|
|
|
}
|
|
|
|
|
2021-06-13 07:37:52 +00:00
|
|
|
QPointer<Ui::BoxContent> show(
|
|
|
|
object_ptr<Ui::BoxContent> content,
|
|
|
|
Ui::LayerOptions options = Ui::LayerOption::KeepOther,
|
|
|
|
anim::type animated = anim::type::normal);
|
|
|
|
|
2019-08-16 12:44:20 +00:00
|
|
|
[[nodiscard]] auto tabbedSelector() const
|
|
|
|
-> not_null<ChatHelpers::TabbedSelector*>;
|
|
|
|
void takeTabbedSelectorOwnershipFrom(not_null<QWidget*> parent);
|
|
|
|
[[nodiscard]] bool hasTabbedSelectorOwnership() const;
|
|
|
|
|
2018-02-14 19:38:01 +00:00
|
|
|
// This is needed for History TopBar updating when searchInChat
|
2019-04-24 10:15:10 +00:00
|
|
|
// is changed in the Dialogs::Widget of the current window.
|
2018-02-14 19:38:01 +00:00
|
|
|
rpl::variable<Dialogs::Key> searchInChat;
|
2019-04-24 10:15:10 +00:00
|
|
|
bool uniqueChatsInSearchResults() const;
|
|
|
|
void openFolder(not_null<Data::Folder*> folder);
|
|
|
|
void closeFolder();
|
|
|
|
const rpl::variable<Data::Folder*> &openedFolder() const;
|
2017-03-27 12:24:38 +00:00
|
|
|
|
2018-01-22 16:42:25 +00:00
|
|
|
void setActiveChatEntry(Dialogs::RowDescriptor row);
|
|
|
|
void setActiveChatEntry(Dialogs::Key key);
|
|
|
|
Dialogs::RowDescriptor activeChatEntryCurrent() const;
|
|
|
|
Dialogs::Key activeChatCurrent() const;
|
|
|
|
rpl::producer<Dialogs::RowDescriptor> activeChatEntryChanges() const;
|
|
|
|
rpl::producer<Dialogs::Key> activeChatChanges() const;
|
|
|
|
rpl::producer<Dialogs::RowDescriptor> activeChatEntryValue() const;
|
|
|
|
rpl::producer<Dialogs::Key> activeChatValue() const;
|
2018-12-30 12:50:23 +00:00
|
|
|
bool jumpToChatListEntry(Dialogs::RowDescriptor row);
|
2019-03-17 08:14:31 +00:00
|
|
|
void showEditPeerBox(PeerData *peer);
|
2017-11-08 16:45:30 +00:00
|
|
|
|
2017-04-07 18:10:49 +00:00
|
|
|
void enableGifPauseReason(GifPauseReason reason);
|
|
|
|
void disableGifPauseReason(GifPauseReason reason);
|
2021-05-25 10:35:38 +00:00
|
|
|
rpl::producer<> gifPauseLevelChanged() const {
|
|
|
|
return _gifPauseLevelChanged.events();
|
2017-04-07 18:10:49 +00:00
|
|
|
}
|
|
|
|
bool isGifPausedAtLeastFor(GifPauseReason reason) const;
|
2020-06-25 14:17:37 +00:00
|
|
|
void floatPlayerAreaUpdated();
|
2017-04-07 18:10:49 +00:00
|
|
|
|
2017-04-09 18:06:06 +00:00
|
|
|
struct ColumnLayout {
|
2021-08-13 18:18:06 +00:00
|
|
|
int bodyWidth = 0;
|
|
|
|
int dialogsWidth = 0;
|
|
|
|
int chatWidth = 0;
|
|
|
|
int thirdWidth = 0;
|
|
|
|
Adaptive::WindowLayout windowLayout = Adaptive::WindowLayout();
|
2017-04-09 18:06:06 +00:00
|
|
|
};
|
2020-03-06 11:37:48 +00:00
|
|
|
[[nodiscard]] ColumnLayout computeColumnLayout() const;
|
2017-05-13 12:02:07 +00:00
|
|
|
int dialogsSmallColumnWidth() const;
|
2017-09-19 18:59:10 +00:00
|
|
|
bool forceWideDialogs() const;
|
2017-09-16 16:53:41 +00:00
|
|
|
void updateColumnLayout();
|
|
|
|
bool canShowThirdSection() const;
|
2017-09-19 10:32:34 +00:00
|
|
|
bool canShowThirdSectionWithoutResize() const;
|
|
|
|
bool takeThirdSectionFromLayer();
|
2017-09-16 16:53:41 +00:00
|
|
|
void resizeForThirdSection();
|
|
|
|
void closeThirdSection();
|
2017-10-03 13:05:58 +00:00
|
|
|
|
2021-03-16 13:16:01 +00:00
|
|
|
enum class GroupCallJoinConfirm {
|
|
|
|
None,
|
|
|
|
IfNowInAnother,
|
|
|
|
Always,
|
|
|
|
};
|
2020-12-08 15:09:13 +00:00
|
|
|
void startOrJoinGroupCall(
|
2020-12-14 12:52:18 +00:00
|
|
|
not_null<PeerData*> peer,
|
2021-03-10 20:03:20 +00:00
|
|
|
QString joinHash = QString(),
|
2021-03-16 13:16:01 +00:00
|
|
|
GroupCallJoinConfirm confirm = GroupCallJoinConfirm::IfNowInAnother);
|
2020-12-08 15:09:13 +00:00
|
|
|
|
2017-09-16 16:53:41 +00:00
|
|
|
void showSection(
|
2020-12-14 14:48:10 +00:00
|
|
|
std::shared_ptr<SectionMemento> memento,
|
2017-12-04 07:33:33 +00:00
|
|
|
const SectionShow ¶ms = SectionShow()) override;
|
2017-09-20 10:23:57 +00:00
|
|
|
void showBackFromStack(
|
2017-12-04 07:33:33 +00:00
|
|
|
const SectionShow ¶ms = SectionShow()) override;
|
2017-09-16 16:53:41 +00:00
|
|
|
|
2020-09-22 15:05:07 +00:00
|
|
|
using SessionNavigation::showPeerHistory;
|
2017-09-16 16:53:41 +00:00
|
|
|
void showPeerHistory(
|
|
|
|
PeerId peerId,
|
2017-10-03 17:41:44 +00:00
|
|
|
const SectionShow ¶ms = SectionShow::Way::ClearStack,
|
2020-09-22 15:05:07 +00:00
|
|
|
MsgId msgId = ShowAtUnreadMsgId) override;
|
2017-10-03 13:05:58 +00:00
|
|
|
|
2021-06-15 23:06:22 +00:00
|
|
|
void showPeerHistoryAtItem(not_null<const HistoryItem*> item);
|
2021-06-18 06:39:10 +00:00
|
|
|
void cancelUploadLayer(not_null<HistoryItem*> item);
|
2021-06-15 23:06:22 +00:00
|
|
|
|
2021-02-17 05:48:39 +00:00
|
|
|
void showLayer(
|
|
|
|
std::unique_ptr<Ui::LayerWidget> &&layer,
|
|
|
|
Ui::LayerOptions options,
|
|
|
|
anim::type animated = anim::type::normal);
|
|
|
|
|
2017-10-03 13:05:58 +00:00
|
|
|
void showSpecialLayer(
|
2019-09-18 11:19:05 +00:00
|
|
|
object_ptr<Ui::LayerWidget> &&layer,
|
2017-10-03 13:05:58 +00:00
|
|
|
anim::type animated = anim::type::normal);
|
|
|
|
void hideSpecialLayer(
|
|
|
|
anim::type animated = anim::type::normal) {
|
|
|
|
showSpecialLayer(nullptr, animated);
|
2017-09-20 10:23:57 +00:00
|
|
|
}
|
2018-09-06 14:58:43 +00:00
|
|
|
void removeLayerBlackout();
|
2017-04-09 18:06:06 +00:00
|
|
|
|
2017-09-20 10:23:57 +00:00
|
|
|
void showJumpToDate(
|
2018-02-21 21:17:36 +00:00
|
|
|
Dialogs::Key chat,
|
2017-09-20 10:23:57 +00:00
|
|
|
QDate requestedDate);
|
2017-08-01 11:43:50 +00:00
|
|
|
|
2021-02-03 01:17:03 +00:00
|
|
|
void showAddContact();
|
|
|
|
void showNewGroup();
|
|
|
|
void showNewChannel();
|
|
|
|
|
2018-04-06 18:47:29 +00:00
|
|
|
void showPassportForm(const Passport::FormRequest &request);
|
|
|
|
void clearPassportForm();
|
2018-03-18 08:51:14 +00:00
|
|
|
|
2021-06-14 06:33:54 +00:00
|
|
|
void openPhoto(not_null<PhotoData*> photo, FullMsgId contextId);
|
|
|
|
void openPhoto(not_null<PhotoData*> photo, not_null<PeerData*> peer);
|
2021-06-16 21:31:15 +00:00
|
|
|
void openDocument(
|
|
|
|
not_null<DocumentData*> document,
|
|
|
|
FullMsgId contextId,
|
|
|
|
bool showInMediaView = false);
|
2021-06-14 06:33:54 +00:00
|
|
|
|
2021-02-15 17:37:22 +00:00
|
|
|
void showChooseReportMessages(
|
|
|
|
not_null<PeerData*> peer,
|
|
|
|
Ui::ReportReason reason,
|
|
|
|
Fn<void(MessageIdsList)> done);
|
|
|
|
void clearChooseReportMessages();
|
|
|
|
|
2017-04-09 18:06:06 +00:00
|
|
|
base::Variable<bool> &dialogsListFocused() {
|
|
|
|
return _dialogsListFocused;
|
|
|
|
}
|
2017-05-17 11:50:00 +00:00
|
|
|
const base::Variable<bool> &dialogsListFocused() const {
|
|
|
|
return _dialogsListFocused;
|
|
|
|
}
|
2017-04-09 18:06:06 +00:00
|
|
|
base::Variable<bool> &dialogsListDisplayForced() {
|
|
|
|
return _dialogsListDisplayForced;
|
|
|
|
}
|
2017-05-17 11:50:00 +00:00
|
|
|
const base::Variable<bool> &dialogsListDisplayForced() const {
|
|
|
|
return _dialogsListDisplayForced;
|
|
|
|
}
|
2017-04-09 18:06:06 +00:00
|
|
|
|
2019-06-06 10:21:40 +00:00
|
|
|
not_null<SessionController*> parentController() override {
|
2017-12-04 07:33:33 +00:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2020-03-03 12:07:22 +00:00
|
|
|
[[nodiscard]] int filtersWidth() const;
|
|
|
|
[[nodiscard]] rpl::producer<FilterId> activeChatsFilter() const;
|
|
|
|
[[nodiscard]] FilterId activeChatsFilterCurrent() const;
|
|
|
|
void setActiveChatsFilter(FilterId id);
|
|
|
|
|
|
|
|
void toggleFiltersMenu(bool enabled);
|
2020-03-18 12:14:45 +00:00
|
|
|
[[nodiscard]] rpl::producer<> filtersMenuChanged() const;
|
2020-03-03 12:07:22 +00:00
|
|
|
|
2021-08-13 18:18:06 +00:00
|
|
|
[[nodiscard]] const BackgroundState &backgroundState(QSize area);
|
|
|
|
[[nodiscard]] rpl::producer<> repaintBackgroundRequests() const;
|
2021-08-13 15:39:50 +00:00
|
|
|
|
2018-01-21 14:49:42 +00:00
|
|
|
rpl::lifetime &lifetime() {
|
|
|
|
return _lifetime;
|
|
|
|
}
|
|
|
|
|
2017-03-27 12:24:38 +00:00
|
|
|
private:
|
2019-01-18 12:27:37 +00:00
|
|
|
void init();
|
2018-12-30 12:50:23 +00:00
|
|
|
void initSupportMode();
|
2020-03-18 14:10:22 +00:00
|
|
|
void refreshFiltersMenu();
|
|
|
|
void checkOpenedFilter();
|
2020-07-06 14:08:28 +00:00
|
|
|
void suggestArchiveAndMute();
|
2018-12-30 12:50:23 +00:00
|
|
|
|
2017-09-16 16:53:41 +00:00
|
|
|
int minimalThreeColumnWidth() const;
|
2017-11-12 16:50:58 +00:00
|
|
|
int countDialogsWidthFromRatio(int bodyWidth) const;
|
|
|
|
int countThirdColumnWidthFromRatio(int bodyWidth) const;
|
|
|
|
struct ShrinkResult {
|
|
|
|
int dialogsWidth;
|
|
|
|
int thirdWidth;
|
|
|
|
};
|
|
|
|
ShrinkResult shrinkDialogsAndThirdColumns(
|
|
|
|
int dialogsWidth,
|
|
|
|
int thirdWidth,
|
|
|
|
int bodyWidth) const;
|
2017-09-15 17:34:41 +00:00
|
|
|
|
2018-12-30 12:50:23 +00:00
|
|
|
void pushToChatEntryHistory(Dialogs::RowDescriptor row);
|
|
|
|
bool chatEntryHistoryMove(int steps);
|
2020-05-12 08:18:52 +00:00
|
|
|
void resetFakeUnreadWhileOpened();
|
2018-12-30 12:50:23 +00:00
|
|
|
|
2020-07-01 14:19:25 +00:00
|
|
|
void checkInvitePeek();
|
|
|
|
|
2021-08-13 15:39:50 +00:00
|
|
|
void cacheBackground();
|
|
|
|
void clearCachedBackground();
|
2021-08-13 18:18:06 +00:00
|
|
|
void setCachedBackground(CachedBackground &&cached);
|
2021-08-13 15:39:50 +00:00
|
|
|
|
2019-09-03 15:24:51 +00:00
|
|
|
const not_null<Controller*> _window;
|
2017-04-07 18:10:49 +00:00
|
|
|
|
2018-04-06 18:47:29 +00:00
|
|
|
std::unique_ptr<Passport::FormController> _passportForm;
|
2020-03-03 12:07:22 +00:00
|
|
|
std::unique_ptr<FiltersMenu> _filters;
|
2018-03-18 08:51:14 +00:00
|
|
|
|
2017-08-31 16:28:58 +00:00
|
|
|
GifPauseReasons _gifPauseReasons = 0;
|
2021-05-25 10:35:38 +00:00
|
|
|
rpl::event_stream<> _gifPauseLevelChanged;
|
2017-04-07 18:10:49 +00:00
|
|
|
|
2019-08-16 12:44:20 +00:00
|
|
|
// Depends on _gifPause*.
|
|
|
|
const std::unique_ptr<ChatHelpers::TabbedSelector> _tabbedSelector;
|
|
|
|
|
2018-01-22 16:42:25 +00:00
|
|
|
rpl::variable<Dialogs::RowDescriptor> _activeChatEntry;
|
2017-04-09 18:06:06 +00:00
|
|
|
base::Variable<bool> _dialogsListFocused = { false };
|
|
|
|
base::Variable<bool> _dialogsListDisplayForced = { false };
|
2018-12-30 12:50:23 +00:00
|
|
|
std::deque<Dialogs::RowDescriptor> _chatEntryHistory;
|
|
|
|
int _chatEntryHistoryPosition = -1;
|
2020-06-30 15:05:12 +00:00
|
|
|
bool _selectingPeer = false;
|
2017-04-09 18:06:06 +00:00
|
|
|
|
2020-07-01 14:19:25 +00:00
|
|
|
base::Timer _invitePeekTimer;
|
|
|
|
|
2020-03-03 12:07:22 +00:00
|
|
|
rpl::variable<FilterId> _activeChatsFilter;
|
|
|
|
|
2019-03-17 08:14:31 +00:00
|
|
|
PeerData *_showEditPeer = nullptr;
|
2019-04-24 10:15:10 +00:00
|
|
|
rpl::variable<Data::Folder*> _openedFolder;
|
2019-03-17 08:14:31 +00:00
|
|
|
|
2020-03-18 12:14:45 +00:00
|
|
|
rpl::event_stream<> _filtersMenuChanged;
|
|
|
|
|
2021-08-13 18:18:06 +00:00
|
|
|
BackgroundState _backgroundState;
|
|
|
|
Ui::Animations::Simple _backgroundFade;
|
2021-08-13 17:19:06 +00:00
|
|
|
QSize _willCacheForArea;
|
2021-08-13 16:31:55 +00:00
|
|
|
crl::time _lastAreaChangeTime = 0;
|
2021-08-13 15:39:50 +00:00
|
|
|
base::Timer _cacheBackgroundTimer;
|
2021-08-13 18:18:06 +00:00
|
|
|
rpl::event_stream<> _repaintBackgroundRequests;
|
2021-08-13 15:39:50 +00:00
|
|
|
|
2018-01-21 14:49:42 +00:00
|
|
|
rpl::lifetime _lifetime;
|
|
|
|
|
2017-03-27 12:24:38 +00:00
|
|
|
};
|
|
|
|
|
2020-06-13 12:49:21 +00:00
|
|
|
void ActivateWindow(not_null<SessionController*> controller);
|
|
|
|
|
2017-03-27 12:24:38 +00:00
|
|
|
} // namespace Window
|