mirror of https://github.com/procxx/kepka.git
Show folder using slide animation.
This commit is contained in:
parent
6dd8f32f66
commit
f56df0e1d9
File diff suppressed because it is too large
Load Diff
|
@ -7,18 +7,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "dialogs/dialogs_widget.h"
|
|
||||||
#include "dialogs/dialogs_key.h"
|
#include "dialogs/dialogs_key.h"
|
||||||
#include "data/data_messages.h"
|
#include "data/data_messages.h"
|
||||||
#include "ui/effects/animations.h"
|
#include "ui/effects/animations.h"
|
||||||
#include "ui/rp_widget.h"
|
#include "ui/rp_widget.h"
|
||||||
#include "base/flags.h"
|
#include "base/flags.h"
|
||||||
|
|
||||||
namespace Dialogs {
|
class AuthSession;
|
||||||
class Row;
|
|
||||||
class FakeRow;
|
|
||||||
class IndexedList;
|
|
||||||
} // namespace Dialogs
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class IconButton;
|
class IconButton;
|
||||||
|
@ -30,18 +25,44 @@ namespace Window {
|
||||||
class Controller;
|
class Controller;
|
||||||
} // namespace Window
|
} // namespace Window
|
||||||
|
|
||||||
class DialogsInner
|
namespace Dialogs {
|
||||||
|
|
||||||
|
class Row;
|
||||||
|
class FakeRow;
|
||||||
|
class IndexedList;
|
||||||
|
|
||||||
|
struct ChosenRow {
|
||||||
|
Key key;
|
||||||
|
Data::MessagePosition message;
|
||||||
|
bool filteredRow = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class SearchRequestType {
|
||||||
|
FromStart,
|
||||||
|
FromOffset,
|
||||||
|
PeerFromStart,
|
||||||
|
PeerFromOffset,
|
||||||
|
MigratedFromStart,
|
||||||
|
MigratedFromOffset,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class WidgetState {
|
||||||
|
Default,
|
||||||
|
Filtered,
|
||||||
|
};
|
||||||
|
|
||||||
|
class InnerWidget
|
||||||
: public Ui::RpWidget
|
: public Ui::RpWidget
|
||||||
, public RPCSender
|
, public RPCSender
|
||||||
, private base::Subscriber {
|
, private base::Subscriber {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DialogsInner(QWidget *parent, not_null<Window::Controller*> controller);
|
InnerWidget(QWidget *parent, not_null<Window::Controller*> controller);
|
||||||
|
|
||||||
bool searchReceived(
|
bool searchReceived(
|
||||||
const QVector<MTPMessage> &result,
|
const QVector<MTPMessage> &result,
|
||||||
DialogsSearchRequestType type,
|
SearchRequestType type,
|
||||||
int fullCount);
|
int fullCount);
|
||||||
void peerSearchReceived(
|
void peerSearchReceived(
|
||||||
const QString &query,
|
const QString &query,
|
||||||
|
@ -50,15 +71,14 @@ public:
|
||||||
|
|
||||||
void activate();
|
void activate();
|
||||||
|
|
||||||
bool openFolder(not_null<Data::Folder*> folder);
|
void changeOpenedFolder(Data::Folder *folder);
|
||||||
bool cancelFolder();
|
|
||||||
void selectSkip(int32 direction);
|
void selectSkip(int32 direction);
|
||||||
void selectSkipPage(int32 pixels, int32 direction);
|
void selectSkipPage(int32 pixels, int32 direction);
|
||||||
|
|
||||||
void refreshDialog(Dialogs::Key key);
|
void refreshDialog(Key key);
|
||||||
void removeDialog(Dialogs::Key key);
|
void removeDialog(Key key);
|
||||||
void repaintDialogRow(Dialogs::Mode list, not_null<Dialogs::Row*> row);
|
void repaintDialogRow(Mode list, not_null<Row*> row);
|
||||||
void repaintDialogRow(Dialogs::RowDescriptor row);
|
void repaintDialogRow(RowDescriptor row);
|
||||||
|
|
||||||
void dragLeft();
|
void dragLeft();
|
||||||
|
|
||||||
|
@ -67,7 +87,7 @@ public:
|
||||||
|
|
||||||
bool chooseRow();
|
bool chooseRow();
|
||||||
|
|
||||||
void scrollToEntry(const Dialogs::RowDescriptor &entry);
|
void scrollToEntry(const RowDescriptor &entry);
|
||||||
|
|
||||||
Data::Folder *shownFolder() const;
|
Data::Folder *shownFolder() const;
|
||||||
int32 lastSearchDate() const;
|
int32 lastSearchDate() const;
|
||||||
|
@ -75,17 +95,13 @@ public:
|
||||||
MsgId lastSearchId() const;
|
MsgId lastSearchId() const;
|
||||||
MsgId lastSearchMigratedId() const;
|
MsgId lastSearchMigratedId() const;
|
||||||
|
|
||||||
enum class State {
|
WidgetState state() const;
|
||||||
Default,
|
|
||||||
Filtered,
|
|
||||||
};
|
|
||||||
State state() const;
|
|
||||||
bool waitingForSearch() const {
|
bool waitingForSearch() const {
|
||||||
return _waitingForSearch;
|
return _waitingForSearch;
|
||||||
}
|
}
|
||||||
bool hasFilteredResults() const;
|
bool hasFilteredResults() const;
|
||||||
|
|
||||||
void searchInChat(Dialogs::Key key, UserData *from);
|
void searchInChat(Key key, UserData *from);
|
||||||
|
|
||||||
void applyFilterUpdate(QString newFilter, bool force = false);
|
void applyFilterUpdate(QString newFilter, bool force = false);
|
||||||
void onHashtagFilterUpdate(QStringRef newFilter);
|
void onHashtagFilterUpdate(QStringRef newFilter);
|
||||||
|
@ -97,9 +113,11 @@ public:
|
||||||
|
|
||||||
base::Observable<UserData*> searchFromUserChanged;
|
base::Observable<UserData*> searchFromUserChanged;
|
||||||
|
|
||||||
|
rpl::producer<ChosenRow> chosenRow() const;
|
||||||
|
|
||||||
void notify_historyMuteUpdated(History *history);
|
void notify_historyMuteUpdated(History *history);
|
||||||
|
|
||||||
~DialogsInner();
|
~InnerWidget();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void onParentGeometryChanged();
|
void onParentGeometryChanged();
|
||||||
|
@ -109,7 +127,6 @@ signals:
|
||||||
void mustScrollTo(int scrollToTop, int scrollToBottom);
|
void mustScrollTo(int scrollToTop, int scrollToBottom);
|
||||||
void dialogMoved(int movedFrom, int movedTo);
|
void dialogMoved(int movedFrom, int movedTo);
|
||||||
void searchMessages();
|
void searchMessages();
|
||||||
void clearSearchQuery();
|
|
||||||
void cancelSearchInChat();
|
void cancelSearchInChat();
|
||||||
void completeHashtag(QString tag);
|
void completeHashtag(QString tag);
|
||||||
void refreshHashtags();
|
void refreshHashtags();
|
||||||
|
@ -140,21 +157,16 @@ private:
|
||||||
NextOrOriginal,
|
NextOrOriginal,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ChosenRow {
|
|
||||||
Dialogs::Key key;
|
|
||||||
Data::MessagePosition message;
|
|
||||||
};
|
|
||||||
|
|
||||||
AuthSession &session() const;
|
AuthSession &session() const;
|
||||||
|
|
||||||
void dialogRowReplaced(Dialogs::Row *oldRow, Dialogs::Row *newRow);
|
void dialogRowReplaced(Row *oldRow, Row *newRow);
|
||||||
|
|
||||||
bool switchImportantChats();
|
bool switchImportantChats();
|
||||||
bool chooseHashtag();
|
bool chooseHashtag();
|
||||||
ChosenRow computeChosenRow() const;
|
ChosenRow computeChosenRow() const;
|
||||||
bool isSearchResultActive(
|
bool isSearchResultActive(
|
||||||
not_null<Dialogs::FakeRow*> result,
|
not_null<FakeRow*> result,
|
||||||
const Dialogs::RowDescriptor &entry) const;
|
const RowDescriptor &entry) const;
|
||||||
|
|
||||||
void clearMouseSelection(bool clearSelection = false);
|
void clearMouseSelection(bool clearSelection = false);
|
||||||
void mousePressReleased(QPoint globalPosition, Qt::MouseButton button);
|
void mousePressReleased(QPoint globalPosition, Qt::MouseButton button);
|
||||||
|
@ -162,7 +174,7 @@ private:
|
||||||
void selectByMouse(QPoint globalPosition);
|
void selectByMouse(QPoint globalPosition);
|
||||||
void loadPeerPhotos();
|
void loadPeerPhotos();
|
||||||
void setImportantSwitchPressed(bool pressed);
|
void setImportantSwitchPressed(bool pressed);
|
||||||
void setPressed(Dialogs::Row *pressed);
|
void setPressed(Row *pressed);
|
||||||
void setHashtagPressed(int pressed);
|
void setHashtagPressed(int pressed);
|
||||||
void setFilteredPressed(int pressed);
|
void setFilteredPressed(int pressed);
|
||||||
void setPeerSearchPressed(int pressed);
|
void setPeerSearchPressed(int pressed);
|
||||||
|
@ -187,17 +199,15 @@ private:
|
||||||
bool hasHistoryInResults(not_null<History*> history) const;
|
bool hasHistoryInResults(not_null<History*> history) const;
|
||||||
|
|
||||||
void setupShortcuts();
|
void setupShortcuts();
|
||||||
Dialogs::RowDescriptor computeJump(
|
RowDescriptor computeJump(
|
||||||
const Dialogs::RowDescriptor &to,
|
const RowDescriptor &to,
|
||||||
JumpSkip skip);
|
JumpSkip skip);
|
||||||
bool jumpToDialogRow(Dialogs::RowDescriptor to);
|
bool jumpToDialogRow(RowDescriptor to);
|
||||||
|
|
||||||
Dialogs::RowDescriptor chatListEntryBefore(
|
RowDescriptor chatListEntryBefore(const RowDescriptor &which) const;
|
||||||
const Dialogs::RowDescriptor &which) const;
|
RowDescriptor chatListEntryAfter(const RowDescriptor &which) const;
|
||||||
Dialogs::RowDescriptor chatListEntryAfter(
|
RowDescriptor chatListEntryFirst() const;
|
||||||
const Dialogs::RowDescriptor &which) const;
|
RowDescriptor chatListEntryLast() const;
|
||||||
Dialogs::RowDescriptor chatListEntryFirst() const;
|
|
||||||
Dialogs::RowDescriptor chatListEntryLast() const;
|
|
||||||
|
|
||||||
void itemRemoved(not_null<const HistoryItem*> item);
|
void itemRemoved(not_null<const HistoryItem*> item);
|
||||||
enum class UpdateRowSection {
|
enum class UpdateRowSection {
|
||||||
|
@ -212,7 +222,7 @@ private:
|
||||||
|
|
||||||
void updateSearchResult(not_null<PeerData*> peer);
|
void updateSearchResult(not_null<PeerData*> peer);
|
||||||
void updateDialogRow(
|
void updateDialogRow(
|
||||||
Dialogs::RowDescriptor row,
|
RowDescriptor row,
|
||||||
QRect updateRect = QRect(),
|
QRect updateRect = QRect(),
|
||||||
UpdateRowSections sections = UpdateRowSection::All);
|
UpdateRowSections sections = UpdateRowSection::All);
|
||||||
void fillSupportSearchMenu(not_null<Ui::PopupMenu*> menu);
|
void fillSupportSearchMenu(not_null<Ui::PopupMenu*> menu);
|
||||||
|
@ -224,7 +234,6 @@ private:
|
||||||
int peerSearchOffset() const;
|
int peerSearchOffset() const;
|
||||||
int searchedOffset() const;
|
int searchedOffset() const;
|
||||||
int searchInChatSkip() const;
|
int searchInChatSkip() const;
|
||||||
int openedFolderSkip() const;
|
|
||||||
|
|
||||||
void paintPeerSearchResult(
|
void paintPeerSearchResult(
|
||||||
Painter &p,
|
Painter &p,
|
||||||
|
@ -232,7 +241,6 @@ private:
|
||||||
int fullWidth,
|
int fullWidth,
|
||||||
bool active,
|
bool active,
|
||||||
bool selected) const;
|
bool selected) const;
|
||||||
void paintOpenedFolder(Painter &p) const;
|
|
||||||
void paintSearchInChat(Painter &p) const;
|
void paintSearchInChat(Painter &p) const;
|
||||||
void paintSearchInPeer(
|
void paintSearchInPeer(
|
||||||
Painter &p,
|
Painter &p,
|
||||||
|
@ -259,9 +267,9 @@ private:
|
||||||
|
|
||||||
void clearSelection();
|
void clearSelection();
|
||||||
void clearSearchResults(bool clearPeerSearchResults = true);
|
void clearSearchResults(bool clearPeerSearchResults = true);
|
||||||
void updateSelectedRow(Dialogs::Key key = Dialogs::Key());
|
void updateSelectedRow(Key key = Key());
|
||||||
|
|
||||||
not_null<Dialogs::IndexedList*> shownDialogs() const;
|
not_null<IndexedList*> shownDialogs() const;
|
||||||
|
|
||||||
void checkReorderPinnedStart(QPoint localPosition);
|
void checkReorderPinnedStart(QPoint localPosition);
|
||||||
int shownPinnedCount() const;
|
int shownPinnedCount() const;
|
||||||
|
@ -269,13 +277,11 @@ private:
|
||||||
bool updateReorderPinned(QPoint localPosition);
|
bool updateReorderPinned(QPoint localPosition);
|
||||||
void finishReorderPinned();
|
void finishReorderPinned();
|
||||||
void stopReorderPinned();
|
void stopReorderPinned();
|
||||||
int countPinnedIndex(Dialogs::Row *ofRow);
|
int countPinnedIndex(Row *ofRow);
|
||||||
void savePinnedOrder();
|
void savePinnedOrder();
|
||||||
bool pinnedShiftAnimationCallback(crl::time now);
|
bool pinnedShiftAnimationCallback(crl::time now);
|
||||||
void handleChatMigration(not_null<ChatData*> chat);
|
void handleChatMigration(not_null<ChatData*> chat);
|
||||||
|
|
||||||
bool changeOpenedFolder(Data::Folder *folder);
|
|
||||||
|
|
||||||
not_null<Window::Controller*> _controller;
|
not_null<Window::Controller*> _controller;
|
||||||
|
|
||||||
bool _mouseSelection = false;
|
bool _mouseSelection = false;
|
||||||
|
@ -283,15 +289,14 @@ private:
|
||||||
Qt::MouseButton _pressButton = Qt::LeftButton;
|
Qt::MouseButton _pressButton = Qt::LeftButton;
|
||||||
|
|
||||||
Data::Folder *_openedFolder = nullptr;
|
Data::Folder *_openedFolder = nullptr;
|
||||||
Text _openedFolderText;
|
|
||||||
|
|
||||||
std::unique_ptr<ImportantSwitch> _importantSwitch;
|
std::unique_ptr<ImportantSwitch> _importantSwitch;
|
||||||
bool _importantSwitchSelected = false;
|
bool _importantSwitchSelected = false;
|
||||||
bool _importantSwitchPressed = false;
|
bool _importantSwitchPressed = false;
|
||||||
Dialogs::Row *_selected = nullptr;
|
Row *_selected = nullptr;
|
||||||
Dialogs::Row *_pressed = nullptr;
|
Row *_pressed = nullptr;
|
||||||
|
|
||||||
Dialogs::Row *_dragging = nullptr;
|
Row *_dragging = nullptr;
|
||||||
int _draggingIndex = -1;
|
int _draggingIndex = -1;
|
||||||
int _aboveIndex = -1;
|
int _aboveIndex = -1;
|
||||||
QPoint _dragStart;
|
QPoint _dragStart;
|
||||||
|
@ -301,7 +306,7 @@ private:
|
||||||
};
|
};
|
||||||
std::vector<PinnedRow> _pinnedRows;
|
std::vector<PinnedRow> _pinnedRows;
|
||||||
Ui::Animations::Basic _pinnedShiftAnimation;
|
Ui::Animations::Basic _pinnedShiftAnimation;
|
||||||
base::flat_set<Dialogs::Key> _pinnedOnDragStart;
|
base::flat_set<Key> _pinnedOnDragStart;
|
||||||
|
|
||||||
// Remember the last currently dragged row top shift for updating area.
|
// Remember the last currently dragged row top shift for updating area.
|
||||||
int _aboveTopShift = -1;
|
int _aboveTopShift = -1;
|
||||||
|
@ -316,10 +321,10 @@ private:
|
||||||
bool _hashtagDeleteSelected = false;
|
bool _hashtagDeleteSelected = false;
|
||||||
bool _hashtagDeletePressed = false;
|
bool _hashtagDeletePressed = false;
|
||||||
|
|
||||||
std::vector<not_null<Dialogs::Row*>> _filterResults;
|
std::vector<not_null<Row*>> _filterResults;
|
||||||
base::flat_map<
|
base::flat_map<
|
||||||
not_null<PeerData*>,
|
not_null<PeerData*>,
|
||||||
std::unique_ptr<Dialogs::Row>> _filterResultsGlobal;
|
std::unique_ptr<Row>> _filterResultsGlobal;
|
||||||
int _filteredSelected = -1;
|
int _filteredSelected = -1;
|
||||||
int _filteredPressed = -1;
|
int _filteredPressed = -1;
|
||||||
|
|
||||||
|
@ -330,7 +335,7 @@ private:
|
||||||
int _peerSearchSelected = -1;
|
int _peerSearchSelected = -1;
|
||||||
int _peerSearchPressed = -1;
|
int _peerSearchPressed = -1;
|
||||||
|
|
||||||
std::vector<std::unique_ptr<Dialogs::FakeRow>> _searchResults;
|
std::vector<std::unique_ptr<FakeRow>> _searchResults;
|
||||||
int _searchedCount = 0;
|
int _searchedCount = 0;
|
||||||
int _searchedMigratedCount = 0;
|
int _searchedMigratedCount = 0;
|
||||||
int _searchedSelected = -1;
|
int _searchedSelected = -1;
|
||||||
|
@ -341,23 +346,25 @@ private:
|
||||||
MsgId _lastSearchId = 0;
|
MsgId _lastSearchId = 0;
|
||||||
MsgId _lastSearchMigratedId = 0;
|
MsgId _lastSearchMigratedId = 0;
|
||||||
|
|
||||||
State _state = State::Default;
|
WidgetState _state = WidgetState::Default;
|
||||||
|
|
||||||
object_ptr<Ui::LinkButton> _addContactLnk;
|
object_ptr<Ui::LinkButton> _addContactLnk;
|
||||||
object_ptr<Ui::IconButton> _closeOpenedFolder;
|
|
||||||
object_ptr<Ui::IconButton> _cancelSearchInChat;
|
object_ptr<Ui::IconButton> _cancelSearchInChat;
|
||||||
object_ptr<Ui::IconButton> _cancelSearchFromUser;
|
object_ptr<Ui::IconButton> _cancelSearchFromUser;
|
||||||
|
|
||||||
Dialogs::Key _searchInChat;
|
Key _searchInChat;
|
||||||
History *_searchInMigrated = nullptr;
|
History *_searchInMigrated = nullptr;
|
||||||
UserData *_searchFromUser = nullptr;
|
UserData *_searchFromUser = nullptr;
|
||||||
Text _searchInChatText;
|
Text _searchInChatText;
|
||||||
Text _searchFromUserText;
|
Text _searchFromUserText;
|
||||||
Dialogs::RowDescriptor _menuRow;
|
RowDescriptor _menuRow;
|
||||||
|
|
||||||
Fn<void()> _loadMoreCallback;
|
Fn<void()> _loadMoreCallback;
|
||||||
rpl::event_stream<> _listBottomReached;
|
rpl::event_stream<> _listBottomReached;
|
||||||
|
rpl::event_stream<ChosenRow> _chosenRow;
|
||||||
|
|
||||||
base::unique_qptr<Ui::PopupMenu> _menu;
|
base::unique_qptr<Ui::PopupMenu> _menu;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace Dialogs
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -13,16 +13,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "dialogs/dialogs_key.h"
|
#include "dialogs/dialogs_key.h"
|
||||||
#include "ui/special_buttons.h"
|
#include "ui/special_buttons.h"
|
||||||
|
|
||||||
class DialogsInner;
|
|
||||||
class AuthSession;
|
class AuthSession;
|
||||||
|
|
||||||
namespace Dialogs {
|
|
||||||
struct RowDescriptor;
|
|
||||||
class Row;
|
|
||||||
class FakeRow;
|
|
||||||
class Key;
|
|
||||||
} // namespace Dialogs
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class IconButton;
|
class IconButton;
|
||||||
class PopupMenu;
|
class PopupMenu;
|
||||||
|
@ -39,29 +31,30 @@ class Controller;
|
||||||
class ConnectionState;
|
class ConnectionState;
|
||||||
} // namespace Window
|
} // namespace Window
|
||||||
|
|
||||||
enum DialogsSearchRequestType {
|
namespace Dialogs {
|
||||||
DialogsSearchFromStart,
|
|
||||||
DialogsSearchFromOffset,
|
|
||||||
DialogsSearchPeerFromStart,
|
|
||||||
DialogsSearchPeerFromOffset,
|
|
||||||
DialogsSearchMigratedFromStart,
|
|
||||||
DialogsSearchMigratedFromOffset,
|
|
||||||
};
|
|
||||||
|
|
||||||
class DialogsWidget : public Window::AbstractSectionWidget, public RPCSender {
|
struct RowDescriptor;
|
||||||
|
class Row;
|
||||||
|
class FakeRow;
|
||||||
|
class Key;
|
||||||
|
struct ChosenRow;
|
||||||
|
class InnerWidget;
|
||||||
|
enum class SearchRequestType;
|
||||||
|
|
||||||
|
class Widget : public Window::AbstractSectionWidget, public RPCSender {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DialogsWidget(QWidget *parent, not_null<Window::Controller*> controller);
|
Widget(QWidget *parent, not_null<Window::Controller*> controller);
|
||||||
|
|
||||||
void updateDragInScroll(bool inScroll);
|
void updateDragInScroll(bool inScroll);
|
||||||
|
|
||||||
void searchInChat(Dialogs::Key chat);
|
void searchInChat(Key chat);
|
||||||
|
|
||||||
void refreshDialog(Dialogs::Key key);
|
void refreshDialog(Key key);
|
||||||
void removeDialog(Dialogs::Key key);
|
void removeDialog(Key key);
|
||||||
void repaintDialogRow(Dialogs::Mode list, not_null<Dialogs::Row*> row);
|
void repaintDialogRow(Mode list, not_null<Row*> row);
|
||||||
void repaintDialogRow(Dialogs::RowDescriptor row);
|
void repaintDialogRow(RowDescriptor row);
|
||||||
|
|
||||||
void jumpToTop();
|
void jumpToTop();
|
||||||
|
|
||||||
|
@ -74,9 +67,9 @@ public:
|
||||||
void showAnimated(Window::SlideDirection direction, const Window::SectionSlideParams ¶ms);
|
void showAnimated(Window::SlideDirection direction, const Window::SectionSlideParams ¶ms);
|
||||||
void showFast();
|
void showFast();
|
||||||
|
|
||||||
void scrollToEntry(const Dialogs::RowDescriptor &entry);
|
void scrollToEntry(const RowDescriptor &entry);
|
||||||
|
|
||||||
void searchMessages(const QString &query, Dialogs::Key inChat = {});
|
void searchMessages(const QString &query, Key inChat = {});
|
||||||
void onSearchMore();
|
void onSearchMore();
|
||||||
|
|
||||||
// Float player interface.
|
// Float player interface.
|
||||||
|
@ -85,7 +78,7 @@ public:
|
||||||
|
|
||||||
void notify_historyMuteUpdated(History *history);
|
void notify_historyMuteUpdated(History *history);
|
||||||
|
|
||||||
~DialogsWidget();
|
~Widget();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void cancelled();
|
void cancelled();
|
||||||
|
@ -121,9 +114,14 @@ protected:
|
||||||
void paintEvent(QPaintEvent *e) override;
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
enum class ShowAnimation {
|
||||||
|
External,
|
||||||
|
Internal,
|
||||||
|
};
|
||||||
|
|
||||||
void animationCallback();
|
void animationCallback();
|
||||||
void searchReceived(
|
void searchReceived(
|
||||||
DialogsSearchRequestType type,
|
SearchRequestType type,
|
||||||
const MTPmessages_Messages &result,
|
const MTPmessages_Messages &result,
|
||||||
mtpRequestId requestId);
|
mtpRequestId requestId);
|
||||||
void peerSearchReceived(
|
void peerSearchReceived(
|
||||||
|
@ -133,59 +131,67 @@ private:
|
||||||
void setupSupportMode();
|
void setupSupportMode();
|
||||||
void setupConnectingWidget();
|
void setupConnectingWidget();
|
||||||
bool searchForPeersRequired(const QString &query) const;
|
bool searchForPeersRequired(const QString &query) const;
|
||||||
void setSearchInChat(Dialogs::Key chat, UserData *from = nullptr);
|
void setSearchInChat(Key chat, UserData *from = nullptr);
|
||||||
void showJumpToDate();
|
void showJumpToDate();
|
||||||
void showSearchFrom();
|
void showSearchFrom();
|
||||||
void showMainMenu();
|
void showMainMenu();
|
||||||
void clearSearchCache();
|
void clearSearchCache();
|
||||||
|
void updateControlsVisibility(bool fast = false);
|
||||||
void updateLockUnlockVisibility();
|
void updateLockUnlockVisibility();
|
||||||
|
void updateLoadMoreChatsVisibility();
|
||||||
void updateJumpToDateVisibility(bool fast = false);
|
void updateJumpToDateVisibility(bool fast = false);
|
||||||
void updateSearchFromVisibility(bool fast = false);
|
void updateSearchFromVisibility(bool fast = false);
|
||||||
void updateControlsGeometry();
|
void updateControlsGeometry();
|
||||||
void updateForwardBar();
|
void updateForwardBar();
|
||||||
void checkUpdateStatus();
|
void checkUpdateStatus();
|
||||||
|
void changeOpenedFolder(Data::Folder *folder, anim::type animated);
|
||||||
|
QPixmap grabForFolderSlideAnimation();
|
||||||
|
void startSlideAnimation();
|
||||||
|
|
||||||
void applyFilterUpdate(bool force = false);
|
void applyFilterUpdate(bool force = false);
|
||||||
void refreshLoadMoreButton(bool mayBlock, bool isBlocked);
|
void refreshLoadMoreButton(bool mayBlock, bool isBlocked);
|
||||||
void loadMoreBlockedByDate();
|
void loadMoreBlockedByDate();
|
||||||
|
|
||||||
bool searchFailed(DialogsSearchRequestType type, const RPCError &error, mtpRequestId req);
|
bool searchFailed(SearchRequestType type, const RPCError &error, mtpRequestId req);
|
||||||
bool peopleFailed(const RPCError &error, mtpRequestId req);
|
bool peopleFailed(const RPCError &error, mtpRequestId req);
|
||||||
|
|
||||||
bool _dragInScroll = false;
|
|
||||||
bool _dragForward = false;
|
|
||||||
QTimer _chooseByDragTimer;
|
|
||||||
|
|
||||||
object_ptr<Ui::IconButton> _forwardCancel = { nullptr };
|
|
||||||
object_ptr<Ui::IconButton> _mainMenuToggle;
|
|
||||||
object_ptr<Ui::FlatInput> _filter;
|
|
||||||
object_ptr<Ui::FadeWrapScaled<Ui::IconButton>> _chooseFromUser;
|
|
||||||
object_ptr<Ui::FadeWrapScaled<Ui::IconButton>> _jumpToDate;
|
|
||||||
object_ptr<Ui::CrossButton> _cancelSearch;
|
|
||||||
object_ptr<Ui::IconButton> _lockUnlock;
|
|
||||||
object_ptr<Ui::ScrollArea> _scroll;
|
|
||||||
QPointer<DialogsInner> _inner;
|
|
||||||
class BottomButton;
|
|
||||||
object_ptr<BottomButton> _updateTelegram = { nullptr };
|
|
||||||
object_ptr<BottomButton> _loadMoreChats = { nullptr };
|
|
||||||
std::unique_ptr<Window::ConnectionState> _connecting;
|
|
||||||
|
|
||||||
Ui::Animations::Simple _scrollToAnimation;
|
|
||||||
Ui::Animations::Simple _a_show;
|
|
||||||
Window::SlideDirection _showDirection;
|
|
||||||
QPixmap _cacheUnder, _cacheOver;
|
|
||||||
|
|
||||||
Ui::Animations::Simple _scrollToTopShown;
|
|
||||||
bool _scrollToTopIsShown = false;
|
|
||||||
object_ptr<Ui::HistoryDownButton> _scrollToTop;
|
|
||||||
|
|
||||||
void scrollToTop();
|
void scrollToTop();
|
||||||
void setupScrollUpButton();
|
void setupScrollUpButton();
|
||||||
void updateScrollUpVisibility();
|
void updateScrollUpVisibility();
|
||||||
void startScrollUpButtonAnimation(bool shown);
|
void startScrollUpButtonAnimation(bool shown);
|
||||||
void updateScrollUpPosition();
|
void updateScrollUpPosition();
|
||||||
|
|
||||||
Dialogs::Key _searchInChat;
|
bool _dragInScroll = false;
|
||||||
|
bool _dragForward = false;
|
||||||
|
QTimer _chooseByDragTimer;
|
||||||
|
|
||||||
|
object_ptr<Ui::IconButton> _forwardCancel = { nullptr };
|
||||||
|
object_ptr<Ui::RpWidget> _searchControls;
|
||||||
|
object_ptr<Ui::IconButton> _mainMenuToggle;
|
||||||
|
object_ptr<Ui::FlatInput> _filter;
|
||||||
|
object_ptr<Ui::FadeWrapScaled<Ui::IconButton>> _chooseFromUser;
|
||||||
|
object_ptr<Ui::FadeWrapScaled<Ui::IconButton>> _jumpToDate;
|
||||||
|
object_ptr<Ui::CrossButton> _cancelSearch;
|
||||||
|
object_ptr<Ui::IconButton> _lockUnlock;
|
||||||
|
object_ptr<Ui::ScrollArea> _scroll;
|
||||||
|
QPointer<InnerWidget> _inner;
|
||||||
|
class BottomButton;
|
||||||
|
object_ptr<BottomButton> _updateTelegram = { nullptr };
|
||||||
|
object_ptr<BottomButton> _loadMoreChats = { nullptr };
|
||||||
|
std::unique_ptr<Window::ConnectionState> _connecting;
|
||||||
|
|
||||||
|
Ui::Animations::Simple _scrollToAnimation;
|
||||||
|
Ui::Animations::Simple _a_show;
|
||||||
|
Window::SlideDirection _showDirection = Window::SlideDirection();
|
||||||
|
QPixmap _cacheUnder, _cacheOver;
|
||||||
|
ShowAnimation _showAnimationType = ShowAnimation::External;
|
||||||
|
|
||||||
|
Ui::Animations::Simple _scrollToTopShown;
|
||||||
|
bool _scrollToTopIsShown = false;
|
||||||
|
object_ptr<Ui::HistoryDownButton> _scrollToTop;
|
||||||
|
|
||||||
|
Data::Folder *_openedFolder = nullptr;
|
||||||
|
Key _searchInChat;
|
||||||
History *_searchInMigrated = nullptr;
|
History *_searchInMigrated = nullptr;
|
||||||
UserData *_searchFromUser = nullptr;
|
UserData *_searchFromUser = nullptr;
|
||||||
QString _lastFilterText;
|
QString _lastFilterText;
|
||||||
|
@ -220,3 +226,5 @@ private:
|
||||||
int _draggingScrollDelta = 0;
|
int _draggingScrollDelta = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace Dialogs
|
||||||
|
|
|
@ -18,7 +18,6 @@ class AuthSession;
|
||||||
struct HistoryMessageMarkupButton;
|
struct HistoryMessageMarkupButton;
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
class ConfirmBox;
|
class ConfirmBox;
|
||||||
class DialogsWidget;
|
|
||||||
class HistoryWidget;
|
class HistoryWidget;
|
||||||
class StackItem;
|
class StackItem;
|
||||||
struct FileLoadResult;
|
struct FileLoadResult;
|
||||||
|
@ -35,6 +34,7 @@ namespace Dialogs {
|
||||||
struct RowDescriptor;
|
struct RowDescriptor;
|
||||||
class Row;
|
class Row;
|
||||||
class Key;
|
class Key;
|
||||||
|
class Widget;
|
||||||
} // namespace Dialogs
|
} // namespace Dialogs
|
||||||
|
|
||||||
namespace Media {
|
namespace Media {
|
||||||
|
@ -459,7 +459,7 @@ private:
|
||||||
object_ptr<Ui::PlainShadow> _thirdShadow = { nullptr };
|
object_ptr<Ui::PlainShadow> _thirdShadow = { nullptr };
|
||||||
object_ptr<Ui::ResizeArea> _firstColumnResizeArea = { nullptr };
|
object_ptr<Ui::ResizeArea> _firstColumnResizeArea = { nullptr };
|
||||||
object_ptr<Ui::ResizeArea> _thirdColumnResizeArea = { nullptr };
|
object_ptr<Ui::ResizeArea> _thirdColumnResizeArea = { nullptr };
|
||||||
object_ptr<DialogsWidget> _dialogs;
|
object_ptr<Dialogs::Widget> _dialogs;
|
||||||
object_ptr<HistoryWidget> _history;
|
object_ptr<HistoryWidget> _history;
|
||||||
object_ptr<Window::SectionWidget> _mainSection = { nullptr };
|
object_ptr<Window::SectionWidget> _mainSection = { nullptr };
|
||||||
object_ptr<Window::SectionWidget> _thirdSection = { nullptr };
|
object_ptr<Window::SectionWidget> _thirdSection = { nullptr };
|
||||||
|
|
|
@ -997,6 +997,11 @@ QRect FlatInput::getTextRect() const {
|
||||||
return rect().marginsRemoved(_textMrg + QMargins(-2, -1, -2, -1));
|
return rect().marginsRemoved(_textMrg + QMargins(-2, -1, -2, -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FlatInput::finishAnimations() {
|
||||||
|
_placeholderFocusedAnimation.stop();
|
||||||
|
_placeholderVisibleAnimation.stop();
|
||||||
|
}
|
||||||
|
|
||||||
void FlatInput::paintEvent(QPaintEvent *e) {
|
void FlatInput::paintEvent(QPaintEvent *e) {
|
||||||
Painter p(this);
|
Painter p(this);
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,8 @@ public:
|
||||||
void setPlaceholder(Fn<QString()> placeholderFactory);
|
void setPlaceholder(Fn<QString()> placeholderFactory);
|
||||||
QRect placeholderRect() const;
|
QRect placeholderRect() const;
|
||||||
|
|
||||||
|
void finishAnimations();
|
||||||
|
|
||||||
void setTextMrg(const QMargins &textMrg);
|
void setTextMrg(const QMargins &textMrg);
|
||||||
QRect getTextRect() const;
|
QRect getTextRect() const;
|
||||||
|
|
||||||
|
|
|
@ -108,6 +108,16 @@ Controller::Controller(
|
||||||
Ui::show(Box<EditPeerInfoBox>(peer));
|
Ui::show(Box<EditPeerInfoBox>(peer));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
session->data().chatsListChanges(
|
||||||
|
) | rpl::filter([=](Data::Folder *folder) {
|
||||||
|
return (folder != nullptr)
|
||||||
|
&& (folder == _openedFolder.current())
|
||||||
|
&& folder->chatsList()->indexed(Global::DialogsMode())->empty();
|
||||||
|
}) | rpl::start_with_next([=](Data::Folder *folder) {
|
||||||
|
folder->updateChatListSortPosition();
|
||||||
|
closeFolder();
|
||||||
|
}, lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller::showEditPeerBox(PeerData *peer) {
|
void Controller::showEditPeerBox(PeerData *peer) {
|
||||||
|
@ -137,6 +147,24 @@ void Controller::initSupportMode() {
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Controller::uniqueChatsInSearchResults() const {
|
||||||
|
return session().supportMode()
|
||||||
|
&& !session().settings().supportAllSearchResults()
|
||||||
|
&& !searchInChat.current();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Controller::openFolder(not_null<Data::Folder*> folder) {
|
||||||
|
_openedFolder = folder.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Controller::closeFolder() {
|
||||||
|
_openedFolder = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
const rpl::variable<Data::Folder*> &Controller::openedFolder() const {
|
||||||
|
return _openedFolder;
|
||||||
|
}
|
||||||
|
|
||||||
void Controller::setActiveChatEntry(Dialogs::RowDescriptor row) {
|
void Controller::setActiveChatEntry(Dialogs::RowDescriptor row) {
|
||||||
_activeChatEntry = row;
|
_activeChatEntry = row;
|
||||||
if (session().supportMode()) {
|
if (session().supportMode()) {
|
||||||
|
|
|
@ -150,8 +150,12 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is needed for History TopBar updating when searchInChat
|
// This is needed for History TopBar updating when searchInChat
|
||||||
// is changed in the DialogsWidget of the current window.
|
// is changed in the Dialogs::Widget of the current window.
|
||||||
rpl::variable<Dialogs::Key> searchInChat;
|
rpl::variable<Dialogs::Key> searchInChat;
|
||||||
|
bool uniqueChatsInSearchResults() const;
|
||||||
|
void openFolder(not_null<Data::Folder*> folder);
|
||||||
|
void closeFolder();
|
||||||
|
const rpl::variable<Data::Folder*> &openedFolder() const;
|
||||||
|
|
||||||
void setActiveChatEntry(Dialogs::RowDescriptor row);
|
void setActiveChatEntry(Dialogs::RowDescriptor row);
|
||||||
void setActiveChatEntry(Dialogs::Key key);
|
void setActiveChatEntry(Dialogs::Key key);
|
||||||
|
@ -304,6 +308,7 @@ private:
|
||||||
Media::Player::FloatDelegate *_replacementFloatPlayerDelegate = nullptr;
|
Media::Player::FloatDelegate *_replacementFloatPlayerDelegate = nullptr;
|
||||||
|
|
||||||
PeerData *_showEditPeer = nullptr;
|
PeerData *_showEditPeer = nullptr;
|
||||||
|
rpl::variable<Data::Folder*> _openedFolder;
|
||||||
|
|
||||||
rpl::lifetime _lifetime;
|
rpl::lifetime _lifetime;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue