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"
|
2022-12-05 12:18:10 +00:00
|
|
|
#include "ui/userpic_view.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
|
|
|
|
2022-09-29 10:33:17 +00:00
|
|
|
namespace style {
|
|
|
|
struct DialogRow;
|
|
|
|
} // namespace style
|
|
|
|
|
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 {
|
2022-11-01 04:46:31 +00:00
|
|
|
class Thread;
|
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-11-13 19:38:18 +00:00
|
|
|
struct TopicJumpCache;
|
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:
|
2022-12-01 13:48:33 +00:00
|
|
|
struct ChildListShown {
|
|
|
|
PeerId peerId = 0;
|
|
|
|
float64 shown = 0.;
|
|
|
|
};
|
2019-06-06 10:21:40 +00:00
|
|
|
InnerWidget(
|
|
|
|
QWidget *parent,
|
2022-12-01 13:48:33 +00:00
|
|
|
not_null<Window::SessionController*> controller,
|
|
|
|
rpl::producer<ChildListShown> childListShown);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2022-10-26 12:33:58 +00:00
|
|
|
void searchReceived(
|
|
|
|
std::vector<not_null<HistoryItem*>> 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-11-30 06:31:33 +00:00
|
|
|
void changeOpenedForum(Data::Forum *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();
|
2022-12-01 17:36:26 +00:00
|
|
|
void setNarrowRatio(float64 narrowRatio);
|
2016-12-04 19:40:41 +00:00
|
|
|
|
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-11-14 07:24:31 +00:00
|
|
|
bool chooseRow(
|
|
|
|
Qt::KeyboardModifiers modifiers = {},
|
|
|
|
MsgId pressedTopicRootId = {});
|
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
|
|
|
|
2022-09-29 10:33:17 +00:00
|
|
|
[[nodiscard]] Data::Folder *shownFolder() const;
|
|
|
|
[[nodiscard]] Data::Forum *shownForum() const;
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2022-09-29 10:33:17 +00:00
|
|
|
[[nodiscard]] WidgetState state() const;
|
2022-10-06 15:11:00 +00:00
|
|
|
[[nodiscard]] not_null<const style::DialogRow*> st() const {
|
2022-09-29 10:33:17 +00:00
|
|
|
return _st;
|
|
|
|
}
|
|
|
|
[[nodiscard]] bool waitingForSearch() const {
|
2018-01-07 12:04:34 +00:00
|
|
|
return _waitingForSearch;
|
|
|
|
}
|
2022-09-29 10:33:17 +00:00
|
|
|
[[nodiscard]] 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);
|
2022-10-26 14:18:00 +00:00
|
|
|
void appendToFiltered(Key key);
|
2014-07-04 11:12:54 +00:00
|
|
|
|
2022-11-01 04:46:31 +00:00
|
|
|
Data::Thread *updateFromParentDrag(QPoint globalPosition);
|
2015-06-24 17:24:48 +00:00
|
|
|
|
2018-12-29 13:09:45 +00:00
|
|
|
void setLoadMoreCallback(Fn<void()> callback);
|
2022-10-26 14:18:00 +00:00
|
|
|
void setLoadMoreFilteredCallback(Fn<void()> callback);
|
2018-12-29 13:09:45 +00:00
|
|
|
[[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
|
|
|
};
|
|
|
|
|
2022-11-11 06:23:23 +00:00
|
|
|
struct PinnedRow {
|
|
|
|
anim::value yadd;
|
|
|
|
crl::time animStartTime = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FilterResult {
|
2022-11-11 18:58:51 +00:00
|
|
|
FilterResult(not_null<Row*> row) : row(row) {
|
|
|
|
}
|
|
|
|
|
2022-11-11 06:23:23 +00:00
|
|
|
not_null<Row*> row;
|
|
|
|
int top = 0;
|
|
|
|
|
|
|
|
[[nodiscard]] Key key() const;
|
|
|
|
[[nodiscard]] int bottom() const;
|
|
|
|
};
|
|
|
|
|
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);
|
2022-12-01 17:36:26 +00:00
|
|
|
bool updateEntryHeight(not_null<Entry*> entry);
|
2020-06-12 14:09:04 +00:00
|
|
|
|
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();
|
2022-11-11 06:23:23 +00:00
|
|
|
void scrollToItem(int top, int height);
|
|
|
|
void scrollToDefaultSelected();
|
2019-05-03 10:55:44 +00:00
|
|
|
void setCollapsedPressed(int pressed);
|
2022-11-14 07:24:31 +00:00
|
|
|
void setPressed(Row *pressed, bool pressedTopicJump);
|
|
|
|
void clearPressed();
|
2016-12-05 11:01:08 +00:00
|
|
|
void setHashtagPressed(int pressed);
|
2022-11-30 09:00:41 +00:00
|
|
|
void setFilteredPressed(int pressed, bool pressedTopicJump);
|
2016-12-05 11:01:08 +00:00
|
|
|
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-12-02 10:52:19 +00:00
|
|
|
|
2022-10-24 07:22:26 +00:00
|
|
|
void updateRowCornerStatusShown(not_null<History*> history);
|
|
|
|
void repaintDialogRowCornerStatus(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
|
|
|
|
2022-11-11 06:23:23 +00:00
|
|
|
void refreshShownList();
|
|
|
|
[[nodiscard]] int skipTopHeight() const;
|
|
|
|
[[nodiscard]] int dialogsOffset() const;
|
|
|
|
[[nodiscard]] int shownHeight(int till = -1) const;
|
|
|
|
[[nodiscard]] int fixedOnTopCount() const;
|
|
|
|
[[nodiscard]] int pinnedOffset() const;
|
|
|
|
[[nodiscard]] int filteredOffset() const;
|
|
|
|
[[nodiscard]] int filteredIndex(int y) const;
|
|
|
|
[[nodiscard]] int filteredHeight(int till = -1) const;
|
|
|
|
[[nodiscard]] int peerSearchOffset() const;
|
|
|
|
[[nodiscard]] int searchedOffset() const;
|
|
|
|
[[nodiscard]] 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);
|
2022-10-26 14:49:07 +00:00
|
|
|
void paintSearchInChat(
|
|
|
|
Painter &p,
|
|
|
|
const Ui::PaintContext &context) const;
|
2018-02-14 19:38:01 +00:00
|
|
|
void paintSearchInPeer(
|
|
|
|
Painter &p,
|
|
|
|
not_null<PeerData*> peer,
|
2022-12-05 12:18:10 +00:00
|
|
|
Ui::PeerUserpicView &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;
|
2022-10-26 14:49:07 +00:00
|
|
|
void paintSearchInTopic(
|
|
|
|
Painter &p,
|
|
|
|
const Ui::PaintContext &context,
|
|
|
|
not_null<Data::ForumTopic*> topic,
|
2022-12-05 12:18:10 +00:00
|
|
|
Ui::PeerUserpicView &userpic,
|
2022-10-26 14:49:07 +00:00
|
|
|
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);
|
|
|
|
|
2022-11-11 06:23:23 +00:00
|
|
|
Row *shownRowByKey(Key key);
|
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());
|
2022-10-26 12:33:58 +00:00
|
|
|
void trackSearchResultsHistory(not_null<History*> history);
|
|
|
|
void trackSearchResultsForum(Data::Forum *forum);
|
2014-05-30 08:53:19 +00:00
|
|
|
|
2022-12-06 09:05:05 +00:00
|
|
|
[[nodiscard]] QBrush currentBg() const;
|
|
|
|
|
2022-11-08 13:57:54 +00:00
|
|
|
[[nodiscard]] const std::vector<Key> &pinnedChatsOrder() const;
|
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();
|
2022-10-27 09:22:31 +00:00
|
|
|
void moveCancelSearchButtons();
|
2017-01-30 15:27:13 +00:00
|
|
|
|
2022-11-07 11:42:13 +00:00
|
|
|
void saveChatsFilterScrollState(FilterId filterId);
|
|
|
|
void restoreChatsFilterScrollState(FilterId filterId);
|
|
|
|
|
2022-09-20 18:12:30 +00:00
|
|
|
const not_null<Window::SessionController*> _controller;
|
2017-04-09 18:06:06 +00:00
|
|
|
|
2022-11-11 06:23:23 +00:00
|
|
|
not_null<IndexedList*> _shownList;
|
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;
|
2022-09-29 10:33:17 +00:00
|
|
|
not_null<const style::DialogRow*> _st;
|
2022-11-13 19:38:18 +00:00
|
|
|
mutable std::unique_ptr<Ui::TopicJumpCache> _topicJumpCache;
|
2019-05-03 10:55:44 +00:00
|
|
|
int _collapsedSelected = -1;
|
|
|
|
int _collapsedPressed = -1;
|
2022-11-11 06:23:23 +00:00
|
|
|
bool _skipTopDialog = false;
|
2019-04-24 10:15:10 +00:00
|
|
|
Row *_selected = nullptr;
|
|
|
|
Row *_pressed = nullptr;
|
2022-11-14 07:24:31 +00:00
|
|
|
MsgId _pressedTopicJumpRootId;
|
|
|
|
bool _selectedTopicJump = false;
|
|
|
|
bool _pressedTopicJump = false;
|
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;
|
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;
|
2022-11-30 06:31:33 +00:00
|
|
|
int _narrowWidth = 0;
|
2017-01-30 15:27:13 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
2022-11-11 06:23:23 +00:00
|
|
|
std::vector<FilterResult> _filterResults;
|
2022-10-26 14:18:00 +00:00
|
|
|
base::flat_map<Key, 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;
|
2022-10-26 14:18:00 +00:00
|
|
|
base::flat_set<not_null<History*>> _searchResultsHistories;
|
2022-10-26 12:33:58 +00:00
|
|
|
rpl::lifetime _searchResultsLifetime;
|
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
|
|
|
|
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;
|
2022-12-05 12:18:10 +00:00
|
|
|
mutable Ui::PeerUserpicView _searchInChatUserpic;
|
|
|
|
mutable Ui::PeerUserpicView _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;
|
|
|
|
|
2022-11-01 07:46:31 +00:00
|
|
|
base::flat_map<FilterId, int> _chatsFilterScrollStates;
|
|
|
|
|
2018-06-04 15:35:11 +00:00
|
|
|
Fn<void()> _loadMoreCallback;
|
2022-10-26 14:18:00 +00:00
|
|
|
Fn<void()> _loadMoreFilteredCallback;
|
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;
|
|
|
|
|
2022-12-01 13:48:33 +00:00
|
|
|
rpl::variable<ChildListShown> _childListShown;
|
2022-12-01 17:36:26 +00:00
|
|
|
float64 _narrowRatio = 0.;
|
|
|
|
bool _geometryInited = false;
|
2022-12-01 13:48:33 +00:00
|
|
|
|
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
|