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
|
|
|
|
|
2018-01-04 19:54:35 +00:00
|
|
|
#include "dialogs/dialogs_key.h"
|
2018-02-16 15:46:24 +00:00
|
|
|
#include "data/data_messages.h"
|
2022-03-14 15:18:10 +00:00
|
|
|
#include "ui/dragging_scroll_manager.h"
|
2019-04-01 17:44:54 +00:00
|
|
|
#include "ui/effects/animations.h"
|
2019-04-16 09:29:21 +00:00
|
|
|
#include "ui/rp_widget.h"
|
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-11 16:09:46 +00:00
|
|
|
|
2021-03-12 12:48:00 +00:00
|
|
|
namespace MTP {
|
|
|
|
class Error;
|
|
|
|
} // namespace MTP
|
2016-05-19 12:03:51 +00:00
|
|
|
|
2019-07-24 11:45:24 +00:00
|
|
|
namespace Main {
|
|
|
|
class Session;
|
|
|
|
} // namespace Main
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-06-20 15:40:36 +00:00
|
|
|
namespace Ui {
|
2016-10-27 21:19:38 +00:00
|
|
|
class IconButton;
|
2016-10-26 16:43:13 +00:00
|
|
|
class PopupMenu;
|
2020-03-31 08:36:33 +00:00
|
|
|
class FlatLabel;
|
2022-03-14 12:02:57 +00:00
|
|
|
struct ScrollToRequest;
|
2016-06-20 15:40:36 +00:00
|
|
|
} // namespace Ui
|
|
|
|
|
2017-03-27 12:24:38 +00:00
|
|
|
namespace Window {
|
2019-06-06 10:21:40 +00:00
|
|
|
class SessionController;
|
2017-03-27 12:24:38 +00:00
|
|
|
} // namespace Window
|
|
|
|
|
2020-05-28 14:32:10 +00:00
|
|
|
namespace Data {
|
|
|
|
class CloudImageView;
|
2022-09-26 13:37:32 +00:00
|
|
|
class Folder;
|
|
|
|
class Forum;
|
2020-05-28 14:32:10 +00:00
|
|
|
} // namespace Data
|
|
|
|
|
2022-05-16 11:38:35 +00:00
|
|
|
namespace Dialogs::Ui {
|
|
|
|
using namespace ::Ui;
|
|
|
|
class VideoUserpic;
|
2022-09-29 07:52:18 +00:00
|
|
|
struct PaintContext;
|
2022-05-16 11:38:35 +00:00
|
|
|
} // namespace Dialogs::Ui
|
|
|
|
|
2019-04-24 10:15:10 +00:00
|
|
|
namespace Dialogs {
|
|
|
|
|
2022-06-07 18:05:37 +00:00
|
|
|
extern const char kOptionCtrlClickChatNewWindow[];
|
|
|
|
|
2019-04-24 10:15:10 +00:00
|
|
|
class Row;
|
|
|
|
class FakeRow;
|
|
|
|
class IndexedList;
|
|
|
|
|
|
|
|
struct ChosenRow {
|
|
|
|
Key key;
|
|
|
|
Data::MessagePosition message;
|
|
|
|
bool filteredRow = false;
|
2022-01-04 11:18:13 +00:00
|
|
|
bool newWindow = false;
|
2019-04-24 10:15:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum class SearchRequestType {
|
|
|
|
FromStart,
|
|
|
|
FromOffset,
|
|
|
|
PeerFromStart,
|
|
|
|
PeerFromOffset,
|
|
|
|
MigratedFromStart,
|
|
|
|
MigratedFromOffset,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class WidgetState {
|
|
|
|
Default,
|
|
|
|
Filtered,
|
|
|
|
};
|
|
|
|
|
2021-07-15 11:12:38 +00:00
|
|
|
class InnerWidget final : public Ui::RpWidget {
|
2014-05-30 08:53:19 +00:00
|
|
|
|
|
|
|
public:
|
2019-06-06 10:21:40 +00:00
|
|
|
InnerWidget(
|
|
|
|
QWidget *parent,
|
|
|
|
not_null<Window::SessionController*> controller);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2018-01-22 10:58:11 +00:00
|
|
|
bool searchReceived(
|
|
|
|
const QVector<MTPMessage> &result,
|
2019-08-06 14:43:26 +00:00
|
|
|
HistoryItem *inject,
|
2019-04-24 10:15:10 +00:00
|
|
|
SearchRequestType type,
|
2018-01-22 10:58:11 +00:00
|
|
|
int fullCount);
|
|
|
|
void peerSearchReceived(
|
|
|
|
const QString &query,
|
|
|
|
const QVector<MTPPeer> &my,
|
|
|
|
const QVector<MTPPeer> &result);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2020-02-07 16:07:21 +00:00
|
|
|
[[nodiscard]] FilterId filterId() const;
|
|
|
|
|
2019-04-24 14:12:35 +00:00
|
|
|
void clearSelection();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2019-04-24 10:15:10 +00:00
|
|
|
void changeOpenedFolder(Data::Folder *folder);
|
2022-09-20 09:35:47 +00:00
|
|
|
void changeOpenedForum(ChannelData *forum);
|
2014-05-30 08:53:19 +00:00
|
|
|
void selectSkip(int32 direction);
|
|
|
|
void selectSkipPage(int32 pixels, int32 direction);
|
|
|
|
|
2016-12-04 19:40:41 +00:00
|
|
|
void dragLeft();
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
void clearFilter();
|
|
|
|
void refresh(bool toTop = false);
|
2020-03-31 08:36:33 +00:00
|
|
|
void refreshEmptyLabel();
|
|
|
|
void resizeEmptyLabel();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2022-01-04 11:18:13 +00:00
|
|
|
bool chooseRow(Qt::KeyboardModifiers modifiers = {});
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2019-04-24 10:15:10 +00:00
|
|
|
void scrollToEntry(const RowDescriptor &entry);
|
2014-08-22 07:41:39 +00:00
|
|
|
|
2019-04-18 08:28:43 +00:00
|
|
|
Data::Folder *shownFolder() const;
|
2022-09-26 13:37:32 +00:00
|
|
|
Data::Forum *shownForum() const;
|
2015-11-18 13:11:56 +00:00
|
|
|
int32 lastSearchDate() const;
|
|
|
|
PeerData *lastSearchPeer() const;
|
2014-08-22 07:41:39 +00:00
|
|
|
MsgId lastSearchId() const;
|
2015-11-18 13:11:56 +00:00
|
|
|
MsgId lastSearchMigratedId() const;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2019-04-24 10:15:10 +00:00
|
|
|
WidgetState state() const;
|
2018-01-07 12:04:34 +00:00
|
|
|
bool waitingForSearch() const {
|
|
|
|
return _waitingForSearch;
|
|
|
|
}
|
2015-02-09 23:19:48 +00:00
|
|
|
bool hasFilteredResults() const;
|
2014-07-04 11:12:54 +00:00
|
|
|
|
2020-10-06 12:58:16 +00:00
|
|
|
void searchInChat(Key key, PeerData *from);
|
2015-08-04 15:01:47 +00:00
|
|
|
|
2018-12-29 08:11:54 +00:00
|
|
|
void applyFilterUpdate(QString newFilter, bool force = false);
|
2021-10-19 13:00:21 +00:00
|
|
|
void onHashtagFilterUpdate(QStringView newFilter);
|
2014-07-04 11:12:54 +00:00
|
|
|
|
2018-12-25 12:41:40 +00:00
|
|
|
PeerData *updateFromParentDrag(QPoint globalPosition);
|
2015-06-24 17:24:48 +00:00
|
|
|
|
2018-12-29 13:09:45 +00:00
|
|
|
void setLoadMoreCallback(Fn<void()> callback);
|
|
|
|
[[nodiscard]] rpl::producer<> listBottomReached() const;
|
2021-05-25 10:44:30 +00:00
|
|
|
[[nodiscard]] rpl::producer<> cancelSearchFromUserRequests() const;
|
2020-06-12 12:12:34 +00:00
|
|
|
[[nodiscard]] rpl::producer<ChosenRow> chosenRow() const;
|
|
|
|
[[nodiscard]] rpl::producer<> updated() const;
|
2019-04-24 10:15:10 +00:00
|
|
|
|
2022-03-14 15:18:10 +00:00
|
|
|
[[nodiscard]] rpl::producer<int> scrollByDeltaRequests() const;
|
2022-03-14 12:02:57 +00:00
|
|
|
[[nodiscard]] rpl::producer<Ui::ScrollToRequest> mustScrollTo() const;
|
|
|
|
[[nodiscard]] rpl::producer<Ui::ScrollToRequest> dialogMoved() const;
|
|
|
|
[[nodiscard]] rpl::producer<> searchMessages() const;
|
|
|
|
[[nodiscard]] rpl::producer<> cancelSearchInChatRequests() const;
|
|
|
|
[[nodiscard]] rpl::producer<QString> completeHashtagRequests() const;
|
|
|
|
[[nodiscard]] rpl::producer<> refreshHashtagsRequests() const;
|
2022-03-14 15:18:10 +00:00
|
|
|
|
2022-02-05 15:15:24 +00:00
|
|
|
[[nodiscard]] RowDescriptor resolveChatNext(RowDescriptor from = {}) const;
|
|
|
|
[[nodiscard]] RowDescriptor resolveChatPrevious(RowDescriptor from = {}) const;
|
|
|
|
|
2019-04-24 10:15:10 +00:00
|
|
|
~InnerWidget();
|
2014-07-04 11:12:54 +00:00
|
|
|
|
2022-03-14 12:02:57 +00:00
|
|
|
void parentGeometryChanged();
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2015-09-29 13:24:39 +00:00
|
|
|
protected:
|
2017-09-13 16:57:44 +00:00
|
|
|
void visibleTopBottomUpdated(
|
|
|
|
int visibleTop,
|
|
|
|
int visibleBottom) override;
|
|
|
|
|
2019-04-16 09:29:21 +00:00
|
|
|
void paintEvent(QPaintEvent *e) override;
|
2016-12-04 19:40:41 +00:00
|
|
|
void mouseMoveEvent(QMouseEvent *e) override;
|
|
|
|
void mousePressEvent(QMouseEvent *e) override;
|
2016-12-05 11:01:08 +00:00
|
|
|
void mouseReleaseEvent(QMouseEvent *e) override;
|
2016-12-04 19:40:41 +00:00
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
2021-10-19 13:00:21 +00:00
|
|
|
void enterEventHook(QEnterEvent *e) override;
|
2017-02-11 11:24:37 +00:00
|
|
|
void leaveEventHook(QEvent *e) override;
|
2016-12-04 19:40:41 +00:00
|
|
|
void contextMenuEvent(QContextMenuEvent *e) override;
|
2015-09-29 13:24:39 +00:00
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
private:
|
2019-05-03 10:55:44 +00:00
|
|
|
struct CollapsedRow;
|
2016-12-05 11:01:08 +00:00
|
|
|
struct HashtagResult;
|
|
|
|
struct PeerSearchResult;
|
|
|
|
|
2018-12-29 13:09:45 +00:00
|
|
|
enum class JumpSkip {
|
|
|
|
PreviousOrBegin,
|
|
|
|
NextOrEnd,
|
|
|
|
PreviousOrOriginal,
|
|
|
|
NextOrOriginal,
|
|
|
|
};
|
|
|
|
|
2020-03-31 08:36:33 +00:00
|
|
|
enum class EmptyState : uchar {
|
|
|
|
None,
|
|
|
|
Loading,
|
|
|
|
NoContacts,
|
|
|
|
EmptyFolder,
|
2022-09-20 09:35:47 +00:00
|
|
|
EmptyForum,
|
2020-03-31 08:36:33 +00:00
|
|
|
};
|
|
|
|
|
2019-07-24 11:45:24 +00:00
|
|
|
Main::Session &session() const;
|
2019-04-16 14:05:56 +00:00
|
|
|
|
2019-04-24 10:15:10 +00:00
|
|
|
void dialogRowReplaced(Row *oldRow, Row *newRow);
|
2019-04-16 14:05:56 +00:00
|
|
|
|
2020-03-25 12:27:24 +00:00
|
|
|
void editOpenedFilter();
|
2019-05-03 10:55:44 +00:00
|
|
|
void repaintCollapsedFolderRow(not_null<Data::Folder*> folder);
|
|
|
|
void refreshWithCollapsedRows(bool toTop = false);
|
|
|
|
bool needCollapsedRowsRefresh() const;
|
|
|
|
bool chooseCollapsedRow();
|
2020-02-07 11:34:05 +00:00
|
|
|
void switchToFilter(FilterId filterId);
|
2018-01-07 12:04:34 +00:00
|
|
|
bool chooseHashtag();
|
|
|
|
ChosenRow computeChosenRow() const;
|
2018-11-21 06:43:49 +00:00
|
|
|
bool isSearchResultActive(
|
2019-04-24 10:15:10 +00:00
|
|
|
not_null<FakeRow*> result,
|
|
|
|
const RowDescriptor &entry) const;
|
2018-01-07 12:04:34 +00:00
|
|
|
|
2020-06-12 14:09:04 +00:00
|
|
|
void repaintDialogRow(FilterId filterId, not_null<Row*> row);
|
|
|
|
void repaintDialogRow(RowDescriptor row);
|
|
|
|
void refreshDialogRow(RowDescriptor row);
|
|
|
|
|
2018-12-25 12:41:40 +00:00
|
|
|
void clearMouseSelection(bool clearSelection = false);
|
2022-01-04 11:18:13 +00:00
|
|
|
void mousePressReleased(
|
|
|
|
QPoint globalPosition,
|
|
|
|
Qt::MouseButton button,
|
|
|
|
Qt::KeyboardModifiers modifiers);
|
2016-12-05 11:01:08 +00:00
|
|
|
void clearIrrelevantState();
|
2018-12-25 12:41:40 +00:00
|
|
|
void selectByMouse(QPoint globalPosition);
|
2017-01-30 15:27:13 +00:00
|
|
|
void loadPeerPhotos();
|
2019-05-03 10:55:44 +00:00
|
|
|
void setCollapsedPressed(int pressed);
|
2019-04-24 10:15:10 +00:00
|
|
|
void setPressed(Row *pressed);
|
2016-12-05 11:01:08 +00:00
|
|
|
void setHashtagPressed(int pressed);
|
|
|
|
void setFilteredPressed(int pressed);
|
|
|
|
void setPeerSearchPressed(int pressed);
|
|
|
|
void setSearchedPressed(int pressed);
|
|
|
|
bool isPressed() const {
|
2019-05-03 10:55:44 +00:00
|
|
|
return (_collapsedPressed >= 0)
|
2018-01-03 18:00:11 +00:00
|
|
|
|| _pressed
|
|
|
|
|| (_hashtagPressed >= 0)
|
|
|
|
|| (_filteredPressed >= 0)
|
|
|
|
|| (_peerSearchPressed >= 0)
|
|
|
|
|| (_searchedPressed >= 0);
|
2016-12-05 11:01:08 +00:00
|
|
|
}
|
|
|
|
bool isSelected() const {
|
2019-05-03 10:55:44 +00:00
|
|
|
return (_collapsedSelected >= 0)
|
2018-01-03 18:00:11 +00:00
|
|
|
|| _selected
|
|
|
|
|| (_hashtagSelected >= 0)
|
|
|
|
|| (_filteredSelected >= 0)
|
|
|
|
|| (_peerSearchSelected >= 0)
|
|
|
|
|| (_searchedSelected >= 0);
|
2016-12-05 11:01:08 +00:00
|
|
|
}
|
2018-10-09 15:36:06 +00:00
|
|
|
bool uniqueSearchResults() const;
|
2019-02-01 06:53:15 +00:00
|
|
|
bool hasHistoryInResults(not_null<History*> history) const;
|
2018-01-03 18:00:11 +00:00
|
|
|
|
2019-06-17 14:37:29 +00:00
|
|
|
int defaultRowTop(not_null<Row*> row) const;
|
|
|
|
void setupOnlineStatusCheck();
|
2020-06-12 12:12:34 +00:00
|
|
|
void userOnlineUpdated(not_null<PeerData*> peer);
|
2020-12-02 10:52:19 +00:00
|
|
|
void groupHasCallUpdated(not_null<PeerData*> peer);
|
|
|
|
|
|
|
|
void updateRowCornerStatusShown(
|
|
|
|
not_null<History*> history,
|
|
|
|
bool shown);
|
|
|
|
void updateDialogRowCornerStatus(not_null<History*> history);
|
2019-06-17 14:37:29 +00:00
|
|
|
|
2018-11-16 13:36:42 +00:00
|
|
|
void setupShortcuts();
|
2019-04-24 10:15:10 +00:00
|
|
|
RowDescriptor computeJump(
|
|
|
|
const RowDescriptor &to,
|
2022-02-05 15:15:24 +00:00
|
|
|
JumpSkip skip) const;
|
2019-04-24 10:15:10 +00:00
|
|
|
bool jumpToDialogRow(RowDescriptor to);
|
2018-11-16 13:36:42 +00:00
|
|
|
|
2019-04-24 10:15:10 +00:00
|
|
|
RowDescriptor chatListEntryBefore(const RowDescriptor &which) const;
|
|
|
|
RowDescriptor chatListEntryAfter(const RowDescriptor &which) const;
|
|
|
|
RowDescriptor chatListEntryFirst() const;
|
|
|
|
RowDescriptor chatListEntryLast() const;
|
2018-11-16 13:36:42 +00:00
|
|
|
|
2017-10-05 15:35:52 +00:00
|
|
|
void itemRemoved(not_null<const HistoryItem*> item);
|
2016-12-05 08:45:56 +00:00
|
|
|
enum class UpdateRowSection {
|
2017-09-03 18:36:06 +00:00
|
|
|
Default = (1 << 0),
|
|
|
|
Filtered = (1 << 1),
|
|
|
|
PeerSearch = (1 << 2),
|
|
|
|
MessageSearch = (1 << 3),
|
|
|
|
All = Default | Filtered | PeerSearch | MessageSearch,
|
2016-12-05 08:45:56 +00:00
|
|
|
};
|
2017-08-31 16:28:58 +00:00
|
|
|
using UpdateRowSections = base::flags<UpdateRowSection>;
|
|
|
|
friend inline constexpr auto is_flag_type(UpdateRowSection) { return true; };
|
|
|
|
|
2018-01-04 17:15:04 +00:00
|
|
|
void updateSearchResult(not_null<PeerData*> peer);
|
2018-01-03 18:00:11 +00:00
|
|
|
void updateDialogRow(
|
2019-04-24 10:15:10 +00:00
|
|
|
RowDescriptor row,
|
2018-12-30 08:40:25 +00:00
|
|
|
QRect updateRect = QRect(),
|
2018-01-03 18:00:11 +00:00
|
|
|
UpdateRowSections sections = UpdateRowSection::All);
|
2018-12-30 08:40:25 +00:00
|
|
|
void fillSupportSearchMenu(not_null<Ui::PopupMenu*> menu);
|
2019-06-17 13:29:07 +00:00
|
|
|
void fillArchiveSearchMenu(not_null<Ui::PopupMenu*> menu);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2016-04-11 10:59:01 +00:00
|
|
|
int dialogsOffset() const;
|
2019-05-03 10:55:44 +00:00
|
|
|
int fixedOnTopCount() const;
|
2018-05-11 14:03:53 +00:00
|
|
|
int pinnedOffset() const;
|
2016-04-11 10:59:01 +00:00
|
|
|
int filteredOffset() const;
|
2016-12-05 11:01:08 +00:00
|
|
|
int peerSearchOffset() const;
|
2016-04-11 10:59:01 +00:00
|
|
|
int searchedOffset() const;
|
2018-02-14 19:38:01 +00:00
|
|
|
int searchInChatSkip() const;
|
2016-04-11 10:59:01 +00:00
|
|
|
|
2019-05-03 10:55:44 +00:00
|
|
|
void paintCollapsedRows(
|
|
|
|
Painter &p,
|
|
|
|
QRect clip) const;
|
|
|
|
void paintCollapsedRow(
|
|
|
|
Painter &p,
|
|
|
|
not_null<const CollapsedRow*> row,
|
|
|
|
bool selected) const;
|
2018-01-04 17:15:04 +00:00
|
|
|
void paintPeerSearchResult(
|
|
|
|
Painter &p,
|
|
|
|
not_null<const PeerSearchResult*> result,
|
2022-09-29 07:52:18 +00:00
|
|
|
const Ui::PaintContext &context);
|
2019-04-19 07:08:27 +00:00
|
|
|
void paintSearchInChat(Painter &p) const;
|
2018-02-14 19:38:01 +00:00
|
|
|
void paintSearchInPeer(
|
|
|
|
Painter &p,
|
|
|
|
not_null<PeerData*> peer,
|
2020-05-28 14:32:10 +00:00
|
|
|
std::shared_ptr<Data::CloudImageView> &userpic,
|
2018-02-14 19:38:01 +00:00
|
|
|
int top,
|
2019-06-12 13:26:04 +00:00
|
|
|
const Ui::Text::String &text) const;
|
2018-02-14 19:38:01 +00:00
|
|
|
void paintSearchInSaved(
|
|
|
|
Painter &p,
|
|
|
|
int top,
|
2019-06-12 13:26:04 +00:00
|
|
|
const Ui::Text::String &text) const;
|
2020-09-11 15:33:26 +00:00
|
|
|
void paintSearchInReplies(
|
|
|
|
Painter &p,
|
|
|
|
int top,
|
|
|
|
const Ui::Text::String &text) const;
|
2018-02-14 19:38:01 +00:00
|
|
|
template <typename PaintUserpic>
|
2017-12-05 14:07:01 +00:00
|
|
|
void paintSearchInFilter(
|
|
|
|
Painter &p,
|
2018-02-14 19:38:01 +00:00
|
|
|
PaintUserpic paintUserpic,
|
2017-12-05 14:07:01 +00:00
|
|
|
int top,
|
2018-02-14 19:38:01 +00:00
|
|
|
const style::icon *icon,
|
2019-06-12 13:26:04 +00:00
|
|
|
const Ui::Text::String &text) const;
|
2018-02-14 19:38:01 +00:00
|
|
|
void refreshSearchInChatLabel();
|
2022-08-09 15:53:40 +00:00
|
|
|
void repaintSearchResult(int index);
|
2016-04-11 10:59:01 +00:00
|
|
|
|
2022-05-16 11:38:35 +00:00
|
|
|
Ui::VideoUserpic *validateVideoUserpic(not_null<Row*> row);
|
|
|
|
Ui::VideoUserpic *validateVideoUserpic(not_null<History*> history);
|
|
|
|
|
2016-12-05 11:01:08 +00:00
|
|
|
void clearSearchResults(bool clearPeerSearchResults = true);
|
2019-04-24 10:15:10 +00:00
|
|
|
void updateSelectedRow(Key key = Key());
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2022-09-20 18:12:30 +00:00
|
|
|
[[nodiscard]] not_null<IndexedList*> shownDialogs() const;
|
2016-04-11 10:59:01 +00:00
|
|
|
|
2017-01-30 15:27:13 +00:00
|
|
|
void checkReorderPinnedStart(QPoint localPosition);
|
|
|
|
int updateReorderIndexGetCount();
|
|
|
|
bool updateReorderPinned(QPoint localPosition);
|
|
|
|
void finishReorderPinned();
|
|
|
|
void stopReorderPinned();
|
2019-04-24 10:15:10 +00:00
|
|
|
int countPinnedIndex(Row *ofRow);
|
2017-01-30 15:27:13 +00:00
|
|
|
void savePinnedOrder();
|
2019-04-01 17:44:54 +00:00
|
|
|
bool pinnedShiftAnimationCallback(crl::time now);
|
2020-06-12 14:09:04 +00:00
|
|
|
void handleChatListEntryRefreshes();
|
2017-01-30 15:27:13 +00:00
|
|
|
|
2022-09-20 18:12:30 +00:00
|
|
|
const not_null<Window::SessionController*> _controller;
|
2017-04-09 18:06:06 +00:00
|
|
|
|
2020-02-07 09:43:12 +00:00
|
|
|
FilterId _filterId = 0;
|
2016-12-05 11:01:08 +00:00
|
|
|
bool _mouseSelection = false;
|
2018-12-25 12:41:40 +00:00
|
|
|
std::optional<QPoint> _lastMousePosition;
|
2016-12-05 11:01:08 +00:00
|
|
|
Qt::MouseButton _pressButton = Qt::LeftButton;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2019-04-17 13:22:37 +00:00
|
|
|
Data::Folder *_openedFolder = nullptr;
|
2022-09-26 13:37:32 +00:00
|
|
|
Data::Forum *_openedForum = nullptr;
|
2022-09-20 18:12:30 +00:00
|
|
|
rpl::lifetime _openedForumLifetime;
|
2019-04-19 07:08:27 +00:00
|
|
|
|
2019-05-03 10:55:44 +00:00
|
|
|
std::vector<std::unique_ptr<CollapsedRow>> _collapsedRows;
|
|
|
|
int _collapsedSelected = -1;
|
|
|
|
int _collapsedPressed = -1;
|
2019-06-08 18:11:33 +00:00
|
|
|
int _skipTopDialogs = 0;
|
2019-04-24 10:15:10 +00:00
|
|
|
Row *_selected = nullptr;
|
|
|
|
Row *_pressed = nullptr;
|
2016-12-05 11:01:08 +00:00
|
|
|
|
2019-04-24 10:15:10 +00:00
|
|
|
Row *_dragging = nullptr;
|
2017-01-30 15:27:13 +00:00
|
|
|
int _draggingIndex = -1;
|
|
|
|
int _aboveIndex = -1;
|
|
|
|
QPoint _dragStart;
|
|
|
|
struct PinnedRow {
|
|
|
|
anim::value yadd;
|
2019-02-19 06:57:53 +00:00
|
|
|
crl::time animStartTime = 0;
|
2017-01-30 15:27:13 +00:00
|
|
|
};
|
2017-02-21 13:45:56 +00:00
|
|
|
std::vector<PinnedRow> _pinnedRows;
|
2019-04-01 17:44:54 +00:00
|
|
|
Ui::Animations::Basic _pinnedShiftAnimation;
|
2019-04-24 10:15:10 +00:00
|
|
|
base::flat_set<Key> _pinnedOnDragStart;
|
2017-01-30 15:27:13 +00:00
|
|
|
|
|
|
|
// Remember the last currently dragged row top shift for updating area.
|
|
|
|
int _aboveTopShift = -1;
|
|
|
|
|
|
|
|
int _visibleTop = 0;
|
|
|
|
int _visibleBottom = 0;
|
2015-11-18 13:11:56 +00:00
|
|
|
QString _filter, _hashtagFilter;
|
2015-03-24 10:00:27 +00:00
|
|
|
|
2019-02-01 06:53:15 +00:00
|
|
|
std::vector<std::unique_ptr<HashtagResult>> _hashtagResults;
|
2016-12-05 11:01:08 +00:00
|
|
|
int _hashtagSelected = -1;
|
|
|
|
int _hashtagPressed = -1;
|
|
|
|
bool _hashtagDeleteSelected = false;
|
|
|
|
bool _hashtagDeletePressed = false;
|
2015-03-24 10:00:27 +00:00
|
|
|
|
2019-04-24 10:15:10 +00:00
|
|
|
std::vector<not_null<Row*>> _filterResults;
|
2018-01-22 10:58:11 +00:00
|
|
|
base::flat_map<
|
|
|
|
not_null<PeerData*>,
|
2019-04-24 10:15:10 +00:00
|
|
|
std::unique_ptr<Row>> _filterResultsGlobal;
|
2016-12-05 11:01:08 +00:00
|
|
|
int _filteredSelected = -1;
|
|
|
|
int _filteredPressed = -1;
|
|
|
|
|
2018-01-07 12:04:34 +00:00
|
|
|
bool _waitingForSearch = false;
|
2020-03-31 08:36:33 +00:00
|
|
|
EmptyState _emptyState = EmptyState::None;
|
2018-01-07 12:04:34 +00:00
|
|
|
|
2016-12-05 11:01:08 +00:00
|
|
|
QString _peerSearchQuery;
|
2019-02-01 06:53:15 +00:00
|
|
|
std::vector<std::unique_ptr<PeerSearchResult>> _peerSearchResults;
|
2016-12-05 11:01:08 +00:00
|
|
|
int _peerSearchSelected = -1;
|
|
|
|
int _peerSearchPressed = -1;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2019-04-24 10:15:10 +00:00
|
|
|
std::vector<std::unique_ptr<FakeRow>> _searchResults;
|
2016-04-09 18:45:55 +00:00
|
|
|
int _searchedCount = 0;
|
|
|
|
int _searchedMigratedCount = 0;
|
2016-12-05 11:01:08 +00:00
|
|
|
int _searchedSelected = -1;
|
|
|
|
int _searchedPressed = -1;
|
2014-10-22 18:39:03 +00:00
|
|
|
|
2016-04-09 18:45:55 +00:00
|
|
|
int _lastSearchDate = 0;
|
|
|
|
PeerData *_lastSearchPeer = nullptr;
|
|
|
|
MsgId _lastSearchId = 0;
|
|
|
|
MsgId _lastSearchMigratedId = 0;
|
2014-08-22 07:41:39 +00:00
|
|
|
|
2019-04-24 10:15:10 +00:00
|
|
|
WidgetState _state = WidgetState::Default;
|
2014-07-04 11:12:54 +00:00
|
|
|
|
2020-03-31 08:36:33 +00:00
|
|
|
object_ptr<Ui::FlatLabel> _empty = { nullptr };
|
2018-02-14 19:38:01 +00:00
|
|
|
object_ptr<Ui::IconButton> _cancelSearchInChat;
|
2017-08-06 20:07:51 +00:00
|
|
|
object_ptr<Ui::IconButton> _cancelSearchFromUser;
|
2014-11-25 12:15:29 +00:00
|
|
|
|
2022-03-14 15:18:10 +00:00
|
|
|
Ui::DraggingScrollManager _draggingScroll;
|
|
|
|
|
2019-04-24 10:15:10 +00:00
|
|
|
Key _searchInChat;
|
2018-02-14 19:38:01 +00:00
|
|
|
History *_searchInMigrated = nullptr;
|
2020-10-06 12:58:16 +00:00
|
|
|
PeerData *_searchFromPeer = nullptr;
|
2020-05-28 14:32:10 +00:00
|
|
|
mutable std::shared_ptr<Data::CloudImageView> _searchInChatUserpic;
|
|
|
|
mutable std::shared_ptr<Data::CloudImageView> _searchFromUserUserpic;
|
2019-06-12 13:26:04 +00:00
|
|
|
Ui::Text::String _searchInChatText;
|
|
|
|
Ui::Text::String _searchFromUserText;
|
2019-04-24 10:15:10 +00:00
|
|
|
RowDescriptor _menuRow;
|
2015-12-02 17:17:53 +00:00
|
|
|
|
2022-05-16 11:38:35 +00:00
|
|
|
base::flat_map<
|
|
|
|
not_null<PeerData*>,
|
|
|
|
std::unique_ptr<Ui::VideoUserpic>> _videoUserpics;
|
|
|
|
|
2018-06-04 15:35:11 +00:00
|
|
|
Fn<void()> _loadMoreCallback;
|
2018-12-29 13:09:45 +00:00
|
|
|
rpl::event_stream<> _listBottomReached;
|
2019-04-24 10:15:10 +00:00
|
|
|
rpl::event_stream<ChosenRow> _chosenRow;
|
2020-06-12 12:12:34 +00:00
|
|
|
rpl::event_stream<> _updated;
|
2016-12-05 11:01:08 +00:00
|
|
|
|
2022-03-14 12:02:57 +00:00
|
|
|
rpl::event_stream<Ui::ScrollToRequest> _mustScrollTo;
|
|
|
|
rpl::event_stream<Ui::ScrollToRequest> _dialogMoved;
|
|
|
|
rpl::event_stream<> _searchMessages;
|
|
|
|
rpl::event_stream<QString> _completeHashtagRequests;
|
|
|
|
rpl::event_stream<> _refreshHashtagsRequests;
|
|
|
|
|
2017-11-07 15:12:54 +00:00
|
|
|
base::unique_qptr<Ui::PopupMenu> _menu;
|
|
|
|
|
2014-05-30 08:53:19 +00:00
|
|
|
};
|
2019-04-24 10:15:10 +00:00
|
|
|
|
|
|
|
} // namespace Dialogs
|