mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 15:13:57 +02:00
Replace gsl::not_null<T*> with just not_null<T*>.
This commit is contained in:
parent
cc4023d26a
commit
b3da99c302
148 changed files with 966 additions and 963 deletions
|
@ -49,7 +49,7 @@ constexpr auto kUnreadMentionsNextRequestLimit = 100;
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
ApiWrap::ApiWrap(gsl::not_null<AuthSession*> session)
|
ApiWrap::ApiWrap(not_null<AuthSession*> session)
|
||||||
: _session(session)
|
: _session(session)
|
||||||
, _messageDataResolveDelayed([this] { resolveMessageDatas(); })
|
, _messageDataResolveDelayed([this] { resolveMessageDatas(); })
|
||||||
, _webPagesTimer([this] { resolveWebPages(); })
|
, _webPagesTimer([this] { resolveWebPages(); })
|
||||||
|
@ -1462,7 +1462,7 @@ void ApiWrap::updateStickers() {
|
||||||
requestSavedGifs(now);
|
requestSavedGifs(now);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApiWrap::setGroupStickerSet(gsl::not_null<ChannelData*> megagroup, const MTPInputStickerSet &set) {
|
void ApiWrap::setGroupStickerSet(not_null<ChannelData*> megagroup, const MTPInputStickerSet &set) {
|
||||||
Expects(megagroup->mgInfo != nullptr);
|
Expects(megagroup->mgInfo != nullptr);
|
||||||
megagroup->mgInfo->stickerSet = set;
|
megagroup->mgInfo->stickerSet = set;
|
||||||
request(MTPchannels_SetStickers(megagroup->inputChannel, set)).send();
|
request(MTPchannels_SetStickers(megagroup->inputChannel, set)).send();
|
||||||
|
@ -1720,7 +1720,7 @@ void ApiWrap::applyUpdateNoPtsCheck(const MTPUpdate &update) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApiWrap::jumpToDate(gsl::not_null<PeerData*> peer, const QDate &date) {
|
void ApiWrap::jumpToDate(not_null<PeerData*> peer, const QDate &date) {
|
||||||
// API returns a message with date <= offset_date.
|
// API returns a message with date <= offset_date.
|
||||||
// So we request a message with offset_date = desired_date - 1 and add_offset = -1.
|
// So we request a message with offset_date = desired_date - 1 and add_offset = -1.
|
||||||
// This should give us the first message with date >= desired_date.
|
// This should give us the first message with date >= desired_date.
|
||||||
|
@ -1762,7 +1762,7 @@ void ApiWrap::jumpToDate(gsl::not_null<PeerData*> peer, const QDate &date) {
|
||||||
}).send();
|
}).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApiWrap::preloadEnoughUnreadMentions(gsl::not_null<History*> history) {
|
void ApiWrap::preloadEnoughUnreadMentions(not_null<History*> history) {
|
||||||
auto fullCount = history->getUnreadMentionsCount();
|
auto fullCount = history->getUnreadMentionsCount();
|
||||||
auto loadedCount = history->getUnreadMentionsLoadedCount();
|
auto loadedCount = history->getUnreadMentionsLoadedCount();
|
||||||
auto allLoaded = (fullCount >= 0) ? (loadedCount >= fullCount) : false;
|
auto allLoaded = (fullCount >= 0) ? (loadedCount >= fullCount) : false;
|
||||||
|
@ -1798,7 +1798,7 @@ void ApiWrap::checkForUnreadMentions(const base::flat_set<MsgId> &possiblyReadMe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApiWrap::cancelEditChatAdmins(gsl::not_null<ChatData*> chat) {
|
void ApiWrap::cancelEditChatAdmins(not_null<ChatData*> chat) {
|
||||||
_chatAdminsEnabledRequests.take(chat)
|
_chatAdminsEnabledRequests.take(chat)
|
||||||
| requestCanceller();
|
| requestCanceller();
|
||||||
|
|
||||||
|
@ -1809,9 +1809,9 @@ void ApiWrap::cancelEditChatAdmins(gsl::not_null<ChatData*> chat) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApiWrap::editChatAdmins(
|
void ApiWrap::editChatAdmins(
|
||||||
gsl::not_null<ChatData*> chat,
|
not_null<ChatData*> chat,
|
||||||
bool adminsEnabled,
|
bool adminsEnabled,
|
||||||
base::flat_set<gsl::not_null<UserData*>> &&admins) {
|
base::flat_set<not_null<UserData*>> &&admins) {
|
||||||
cancelEditChatAdmins(chat);
|
cancelEditChatAdmins(chat);
|
||||||
if (adminsEnabled) {
|
if (adminsEnabled) {
|
||||||
_chatAdminsToSave.emplace(chat, std::move(admins));
|
_chatAdminsToSave.emplace(chat, std::move(admins));
|
||||||
|
@ -1830,7 +1830,7 @@ void ApiWrap::editChatAdmins(
|
||||||
_chatAdminsEnabledRequests.emplace(chat, requestId);
|
_chatAdminsEnabledRequests.emplace(chat, requestId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApiWrap::saveChatAdmins(gsl::not_null<ChatData*> chat) {
|
void ApiWrap::saveChatAdmins(not_null<ChatData*> chat) {
|
||||||
if (!_chatAdminsToSave.contains(chat)) {
|
if (!_chatAdminsToSave.contains(chat)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1845,8 +1845,8 @@ void ApiWrap::saveChatAdmins(gsl::not_null<ChatData*> chat) {
|
||||||
_chatAdminsEnabledRequests.emplace(chat, requestId);
|
_chatAdminsEnabledRequests.emplace(chat, requestId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApiWrap::sendSaveChatAdminsRequests(gsl::not_null<ChatData*> chat) {
|
void ApiWrap::sendSaveChatAdminsRequests(not_null<ChatData*> chat) {
|
||||||
auto editOne = [this, chat](gsl::not_null<UserData*> user, bool admin) {
|
auto editOne = [this, chat](not_null<UserData*> user, bool admin) {
|
||||||
auto requestId = request(MTPmessages_EditChatAdmin(
|
auto requestId = request(MTPmessages_EditChatAdmin(
|
||||||
chat->inputChat,
|
chat->inputChat,
|
||||||
user->inputUser,
|
user->inputUser,
|
||||||
|
@ -1892,7 +1892,7 @@ void ApiWrap::sendSaveChatAdminsRequests(gsl::not_null<ChatData*> chat) {
|
||||||
t_assert(!!admins);
|
t_assert(!!admins);
|
||||||
|
|
||||||
auto toRemove = chat->admins;
|
auto toRemove = chat->admins;
|
||||||
auto toAppoint = std::vector<gsl::not_null<UserData*>>();
|
auto toAppoint = std::vector<not_null<UserData*>>();
|
||||||
if (!admins->empty()) {
|
if (!admins->empty()) {
|
||||||
toAppoint.reserve(admins->size());
|
toAppoint.reserve(admins->size());
|
||||||
for (auto user : *admins) {
|
for (auto user : *admins) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ inline const MTPVector<MTPChat> *getChatsFromMessagesChats(const MTPmessages_Cha
|
||||||
|
|
||||||
class ApiWrap : private MTP::Sender, private base::Subscriber {
|
class ApiWrap : private MTP::Sender, private base::Subscriber {
|
||||||
public:
|
public:
|
||||||
ApiWrap(gsl::not_null<AuthSession*> session);
|
ApiWrap(not_null<AuthSession*> session);
|
||||||
|
|
||||||
void start();
|
void start();
|
||||||
void applyUpdates(const MTPUpdates &updates, uint64 sentMessageRandomId = 0);
|
void applyUpdates(const MTPUpdates &updates, uint64 sentMessageRandomId = 0);
|
||||||
|
@ -72,7 +72,7 @@ public:
|
||||||
void requestStickerSets();
|
void requestStickerSets();
|
||||||
void saveStickerSets(const Stickers::Order &localOrder, const Stickers::Order &localRemoved);
|
void saveStickerSets(const Stickers::Order &localOrder, const Stickers::Order &localRemoved);
|
||||||
void updateStickers();
|
void updateStickers();
|
||||||
void setGroupStickerSet(gsl::not_null<ChannelData*> megagroup, const MTPInputStickerSet &set);
|
void setGroupStickerSet(not_null<ChannelData*> megagroup, const MTPInputStickerSet &set);
|
||||||
|
|
||||||
void joinChannel(ChannelData *channel);
|
void joinChannel(ChannelData *channel);
|
||||||
void leaveChannel(ChannelData *channel);
|
void leaveChannel(ChannelData *channel);
|
||||||
|
@ -98,15 +98,15 @@ public:
|
||||||
void applyUpdatesNoPtsCheck(const MTPUpdates &updates);
|
void applyUpdatesNoPtsCheck(const MTPUpdates &updates);
|
||||||
void applyUpdateNoPtsCheck(const MTPUpdate &update);
|
void applyUpdateNoPtsCheck(const MTPUpdate &update);
|
||||||
|
|
||||||
void jumpToDate(gsl::not_null<PeerData*> peer, const QDate &date);
|
void jumpToDate(not_null<PeerData*> peer, const QDate &date);
|
||||||
|
|
||||||
void preloadEnoughUnreadMentions(gsl::not_null<History*> history);
|
void preloadEnoughUnreadMentions(not_null<History*> history);
|
||||||
void checkForUnreadMentions(const base::flat_set<MsgId> &possiblyReadMentions, ChannelData *channel = nullptr);
|
void checkForUnreadMentions(const base::flat_set<MsgId> &possiblyReadMentions, ChannelData *channel = nullptr);
|
||||||
|
|
||||||
void editChatAdmins(
|
void editChatAdmins(
|
||||||
gsl::not_null<ChatData*> chat,
|
not_null<ChatData*> chat,
|
||||||
bool adminsEnabled,
|
bool adminsEnabled,
|
||||||
base::flat_set<gsl::not_null<UserData*>> &&admins);
|
base::flat_set<not_null<UserData*>> &&admins);
|
||||||
|
|
||||||
~ApiWrap();
|
~ApiWrap();
|
||||||
|
|
||||||
|
@ -149,11 +149,11 @@ private:
|
||||||
void requestFeaturedStickers(TimeId now);
|
void requestFeaturedStickers(TimeId now);
|
||||||
void requestSavedGifs(TimeId now);
|
void requestSavedGifs(TimeId now);
|
||||||
|
|
||||||
void cancelEditChatAdmins(gsl::not_null<ChatData*> chat);
|
void cancelEditChatAdmins(not_null<ChatData*> chat);
|
||||||
void saveChatAdmins(gsl::not_null<ChatData*> chat);
|
void saveChatAdmins(not_null<ChatData*> chat);
|
||||||
void sendSaveChatAdminsRequests(gsl::not_null<ChatData*> chat);
|
void sendSaveChatAdminsRequests(not_null<ChatData*> chat);
|
||||||
|
|
||||||
gsl::not_null<AuthSession*> _session;
|
not_null<AuthSession*> _session;
|
||||||
mtpRequestId _changelogSubscription = 0;
|
mtpRequestId _changelogSubscription = 0;
|
||||||
|
|
||||||
MessageDataRequests _messageDataRequests;
|
MessageDataRequests _messageDataRequests;
|
||||||
|
@ -203,11 +203,11 @@ private:
|
||||||
|
|
||||||
mtpRequestId _contactsStatusesRequestId = 0;
|
mtpRequestId _contactsStatusesRequestId = 0;
|
||||||
|
|
||||||
base::flat_map<gsl::not_null<History*>, mtpRequestId> _unreadMentionsRequests;
|
base::flat_map<not_null<History*>, mtpRequestId> _unreadMentionsRequests;
|
||||||
|
|
||||||
base::flat_map<gsl::not_null<ChatData*>, mtpRequestId> _chatAdminsEnabledRequests;
|
base::flat_map<not_null<ChatData*>, mtpRequestId> _chatAdminsEnabledRequests;
|
||||||
base::flat_map<gsl::not_null<ChatData*>, base::flat_set<gsl::not_null<UserData*>>> _chatAdminsToSave;
|
base::flat_map<not_null<ChatData*>, base::flat_set<not_null<UserData*>>> _chatAdminsToSave;
|
||||||
base::flat_map<gsl::not_null<ChatData*>, base::flat_set<mtpRequestId>> _chatAdminsSaveRequests;
|
base::flat_map<not_null<ChatData*>, base::flat_set<mtpRequestId>> _chatAdminsSaveRequests;
|
||||||
|
|
||||||
base::Observable<PeerData*> _fullPeerUpdated;
|
base::Observable<PeerData*> _fullPeerUpdated;
|
||||||
|
|
||||||
|
|
|
@ -61,18 +61,18 @@ public:
|
||||||
base::Observable<void> &savedGifsUpdated() {
|
base::Observable<void> &savedGifsUpdated() {
|
||||||
return _savedGifsUpdated;
|
return _savedGifsUpdated;
|
||||||
}
|
}
|
||||||
base::Observable<gsl::not_null<History*>> &historyCleared() {
|
base::Observable<not_null<History*>> &historyCleared() {
|
||||||
return _historyCleared;
|
return _historyCleared;
|
||||||
}
|
}
|
||||||
base::Observable<gsl::not_null<const HistoryItem*>> &repaintLogEntry() {
|
base::Observable<not_null<const HistoryItem*>> &repaintLogEntry() {
|
||||||
return _repaintLogEntry;
|
return _repaintLogEntry;
|
||||||
}
|
}
|
||||||
base::Observable<void> &pendingHistoryResize() {
|
base::Observable<void> &pendingHistoryResize() {
|
||||||
return _pendingHistoryResize;
|
return _pendingHistoryResize;
|
||||||
}
|
}
|
||||||
struct ItemVisibilityQuery {
|
struct ItemVisibilityQuery {
|
||||||
gsl::not_null<HistoryItem*> item;
|
not_null<HistoryItem*> item;
|
||||||
gsl::not_null<bool*> isVisible;
|
not_null<bool*> isVisible;
|
||||||
};
|
};
|
||||||
base::Observable<ItemVisibilityQuery> &queryItemVisibility() {
|
base::Observable<ItemVisibilityQuery> &queryItemVisibility() {
|
||||||
return _queryItemVisibility;
|
return _queryItemVisibility;
|
||||||
|
@ -162,8 +162,8 @@ private:
|
||||||
base::Observable<void> _moreChatsLoaded;
|
base::Observable<void> _moreChatsLoaded;
|
||||||
base::Observable<void> _stickersUpdated;
|
base::Observable<void> _stickersUpdated;
|
||||||
base::Observable<void> _savedGifsUpdated;
|
base::Observable<void> _savedGifsUpdated;
|
||||||
base::Observable<gsl::not_null<History*>> _historyCleared;
|
base::Observable<not_null<History*>> _historyCleared;
|
||||||
base::Observable<gsl::not_null<const HistoryItem*>> _repaintLogEntry;
|
base::Observable<not_null<const HistoryItem*>> _repaintLogEntry;
|
||||||
base::Observable<void> _pendingHistoryResize;
|
base::Observable<void> _pendingHistoryResize;
|
||||||
base::Observable<ItemVisibilityQuery> _queryItemVisibility;
|
base::Observable<ItemVisibilityQuery> _queryItemVisibility;
|
||||||
Variables _variables;
|
Variables _variables;
|
||||||
|
|
|
@ -78,10 +78,10 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct ChatRow {
|
struct ChatRow {
|
||||||
ChatRow(gsl::not_null<PeerData*> peer) : peer(peer) {
|
ChatRow(not_null<PeerData*> peer) : peer(peer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
gsl::not_null<PeerData*> peer;
|
not_null<PeerData*> peer;
|
||||||
Text name, status;
|
Text name, status;
|
||||||
};
|
};
|
||||||
void paintChat(Painter &p, const ChatRow &row, bool selected) const;
|
void paintChat(Painter &p, const ChatRow &row, bool selected) const;
|
||||||
|
@ -390,7 +390,7 @@ void GroupInfoBox::onNameSubmit() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupInfoBox::createGroup(gsl::not_null<PeerListBox*> selectUsersBox, const QString &title, const std::vector<gsl::not_null<PeerData*>> &users) {
|
void GroupInfoBox::createGroup(not_null<PeerListBox*> selectUsersBox, const QString &title, const std::vector<not_null<PeerData*>> &users) {
|
||||||
if (_creationRequestId) return;
|
if (_creationRequestId) return;
|
||||||
|
|
||||||
auto inputs = QVector<MTPInputUser>();
|
auto inputs = QVector<MTPInputUser>();
|
||||||
|
@ -426,7 +426,7 @@ void GroupInfoBox::createGroup(gsl::not_null<PeerListBox*> selectUsersBox, const
|
||||||
| [](auto chats) {
|
| [](auto chats) {
|
||||||
return App::chat(chats->front().c_chat().vid.v);
|
return App::chat(chats->front().c_chat().vid.v);
|
||||||
}
|
}
|
||||||
| [this](gsl::not_null<ChatData*> chat) {
|
| [this](not_null<ChatData*> chat) {
|
||||||
if (!_photoImage.isNull()) {
|
if (!_photoImage.isNull()) {
|
||||||
Messenger::Instance().uploadProfilePhoto(_photoImage, chat->id);
|
Messenger::Instance().uploadProfilePhoto(_photoImage, chat->id);
|
||||||
}
|
}
|
||||||
|
@ -465,7 +465,7 @@ void GroupInfoBox::onNext() {
|
||||||
if (_creating != CreatingGroupGroup) {
|
if (_creating != CreatingGroupGroup) {
|
||||||
createChannel(title, description);
|
createChannel(title, description);
|
||||||
} else {
|
} else {
|
||||||
auto initBox = [title, weak = weak(this)](gsl::not_null<PeerListBox*> box) {
|
auto initBox = [title, weak = weak(this)](not_null<PeerListBox*> box) {
|
||||||
box->addButton(langFactory(lng_create_group_create), [box, title, weak] {
|
box->addButton(langFactory(lng_create_group_create), [box, title, weak] {
|
||||||
if (weak) {
|
if (weak) {
|
||||||
auto rows = box->peerListCollectSelectedRows();
|
auto rows = box->peerListCollectSelectedRows();
|
||||||
|
@ -505,7 +505,7 @@ void GroupInfoBox::createChannel(const QString &title, const QString &descriptio
|
||||||
| [](auto chats) {
|
| [](auto chats) {
|
||||||
return App::channel(chats->front().c_channel().vid.v);
|
return App::channel(chats->front().c_channel().vid.v);
|
||||||
}
|
}
|
||||||
| [this](gsl::not_null<ChannelData*> channel) {
|
| [this](not_null<ChannelData*> channel) {
|
||||||
if (!_photoImage.isNull()) {
|
if (!_photoImage.isNull()) {
|
||||||
Messenger::Instance().uploadProfilePhoto(
|
Messenger::Instance().uploadProfilePhoto(
|
||||||
_photoImage,
|
_photoImage,
|
||||||
|
@ -909,7 +909,7 @@ bool SetupChannelBox::onFirstCheckFail(const RPCError &error) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
EditNameTitleBox::EditNameTitleBox(QWidget*, gsl::not_null<PeerData*> peer)
|
EditNameTitleBox::EditNameTitleBox(QWidget*, not_null<PeerData*> peer)
|
||||||
: _peer(peer)
|
: _peer(peer)
|
||||||
, _first(this, st::defaultInputField, langFactory(_peer->isUser() ? lng_signup_firstname : lng_dlg_new_group_name), _peer->isUser() ? _peer->asUser()->firstName : _peer->name)
|
, _first(this, st::defaultInputField, langFactory(_peer->isUser() ? lng_signup_firstname : lng_dlg_new_group_name), _peer->isUser() ? _peer->asUser()->firstName : _peer->name)
|
||||||
, _last(this, st::defaultInputField, langFactory(lng_signup_lastname), peer->isUser() ? peer->asUser()->lastName : QString())
|
, _last(this, st::defaultInputField, langFactory(lng_signup_lastname), peer->isUser() ? peer->asUser()->lastName : QString())
|
||||||
|
@ -1064,7 +1064,7 @@ void EditNameTitleBox::onSaveChatDone(const MTPUpdates &updates) {
|
||||||
closeBox();
|
closeBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
EditBioBox::EditBioBox(QWidget*, gsl::not_null<UserData*> self) : BoxContent()
|
EditBioBox::EditBioBox(QWidget*, not_null<UserData*> self) : BoxContent()
|
||||||
, _dynamicFieldStyle(CreateBioFieldStyle())
|
, _dynamicFieldStyle(CreateBioFieldStyle())
|
||||||
, _self(self)
|
, _self(self)
|
||||||
, _bio(this, _dynamicFieldStyle, langFactory(lng_bio_placeholder), _self->about())
|
, _bio(this, _dynamicFieldStyle, langFactory(lng_bio_placeholder), _self->about())
|
||||||
|
@ -1134,7 +1134,7 @@ void EditBioBox::save() {
|
||||||
}).send();
|
}).send();
|
||||||
}
|
}
|
||||||
|
|
||||||
EditChannelBox::EditChannelBox(QWidget*, gsl::not_null<ChannelData*> channel)
|
EditChannelBox::EditChannelBox(QWidget*, not_null<ChannelData*> channel)
|
||||||
: _channel(channel)
|
: _channel(channel)
|
||||||
, _title(this, st::defaultInputField, langFactory(_channel->isMegagroup() ? lng_dlg_new_group_name : lng_dlg_new_channel_name), _channel->name)
|
, _title(this, st::defaultInputField, langFactory(_channel->isMegagroup() ? lng_dlg_new_group_name : lng_dlg_new_channel_name), _channel->name)
|
||||||
, _description(this, st::newGroupDescription, langFactory(lng_create_group_description), _channel->about())
|
, _description(this, st::newGroupDescription, langFactory(lng_create_group_description), _channel->about())
|
||||||
|
|
|
@ -116,7 +116,7 @@ private slots:
|
||||||
private:
|
private:
|
||||||
void setupPhotoButton();
|
void setupPhotoButton();
|
||||||
void createChannel(const QString &title, const QString &description);
|
void createChannel(const QString &title, const QString &description);
|
||||||
void createGroup(gsl::not_null<PeerListBox*> selectUsersBox, const QString &title, const std::vector<gsl::not_null<PeerData*>> &users);
|
void createGroup(not_null<PeerListBox*> selectUsersBox, const QString &title, const std::vector<not_null<PeerData*>> &users);
|
||||||
|
|
||||||
void updateMaxHeight();
|
void updateMaxHeight();
|
||||||
void updateSelected(const QPoint &cursorGlobalPosition);
|
void updateSelected(const QPoint &cursorGlobalPosition);
|
||||||
|
@ -206,7 +206,7 @@ class EditNameTitleBox : public BoxContent, public RPCSender {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EditNameTitleBox(QWidget*, gsl::not_null<PeerData*> peer);
|
EditNameTitleBox(QWidget*, not_null<PeerData*> peer);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setInnerFocus() override;
|
void setInnerFocus() override;
|
||||||
|
@ -225,7 +225,7 @@ private:
|
||||||
void onSaveChatDone(const MTPUpdates &updates);
|
void onSaveChatDone(const MTPUpdates &updates);
|
||||||
bool onSaveChatFail(const RPCError &e);
|
bool onSaveChatFail(const RPCError &e);
|
||||||
|
|
||||||
gsl::not_null<PeerData*> _peer;
|
not_null<PeerData*> _peer;
|
||||||
|
|
||||||
object_ptr<Ui::InputField> _first;
|
object_ptr<Ui::InputField> _first;
|
||||||
object_ptr<Ui::InputField> _last;
|
object_ptr<Ui::InputField> _last;
|
||||||
|
@ -239,7 +239,7 @@ private:
|
||||||
|
|
||||||
class EditBioBox : public BoxContent, private MTP::Sender {
|
class EditBioBox : public BoxContent, private MTP::Sender {
|
||||||
public:
|
public:
|
||||||
EditBioBox(QWidget*, gsl::not_null<UserData*> self);
|
EditBioBox(QWidget*, not_null<UserData*> self);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setInnerFocus() override;
|
void setInnerFocus() override;
|
||||||
|
@ -253,7 +253,7 @@ private:
|
||||||
void save();
|
void save();
|
||||||
|
|
||||||
style::InputField _dynamicFieldStyle;
|
style::InputField _dynamicFieldStyle;
|
||||||
gsl::not_null<UserData*> _self;
|
not_null<UserData*> _self;
|
||||||
|
|
||||||
object_ptr<Ui::InputArea> _bio;
|
object_ptr<Ui::InputArea> _bio;
|
||||||
object_ptr<Ui::FlatLabel> _countdown;
|
object_ptr<Ui::FlatLabel> _countdown;
|
||||||
|
@ -267,7 +267,7 @@ class EditChannelBox : public BoxContent, public RPCSender {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EditChannelBox(QWidget*, gsl::not_null<ChannelData*> channel);
|
EditChannelBox(QWidget*, not_null<ChannelData*> channel);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void prepare() override;
|
void prepare() override;
|
||||||
|
@ -301,7 +301,7 @@ private:
|
||||||
void saveSign();
|
void saveSign();
|
||||||
void saveInvites();
|
void saveInvites();
|
||||||
|
|
||||||
gsl::not_null<ChannelData*> _channel;
|
not_null<ChannelData*> _channel;
|
||||||
|
|
||||||
object_ptr<Ui::InputField> _title;
|
object_ptr<Ui::InputField> _title;
|
||||||
object_ptr<Ui::InputArea> _description;
|
object_ptr<Ui::InputArea> _description;
|
||||||
|
|
|
@ -216,7 +216,7 @@ InformBox::InformBox(QWidget*, const QString &text, base::lambda<void()> closedC
|
||||||
InformBox::InformBox(QWidget*, const QString &text, const QString &doneText, base::lambda<void()> closedCallback) : ConfirmBox(ConfirmBox::InformBoxTag(), text, doneText, std::move(closedCallback)) {
|
InformBox::InformBox(QWidget*, const QString &text, const QString &doneText, base::lambda<void()> closedCallback) : ConfirmBox(ConfirmBox::InformBoxTag(), text, doneText, std::move(closedCallback)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
MaxInviteBox::MaxInviteBox(QWidget*, gsl::not_null<ChannelData*> channel) : BoxContent()
|
MaxInviteBox::MaxInviteBox(QWidget*, not_null<ChannelData*> channel) : BoxContent()
|
||||||
, _channel(channel)
|
, _channel(channel)
|
||||||
, _text(st::boxLabelStyle, lng_participant_invite_sorry(lt_count, Global::ChatSizeMax()), _confirmBoxTextOptions, st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right()) {
|
, _text(st::boxLabelStyle, lng_participant_invite_sorry(lt_count, Global::ChatSizeMax()), _confirmBoxTextOptions, st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right()) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ public:
|
||||||
|
|
||||||
class MaxInviteBox : public BoxContent {
|
class MaxInviteBox : public BoxContent {
|
||||||
public:
|
public:
|
||||||
MaxInviteBox(QWidget*, gsl::not_null<ChannelData*> channel);
|
MaxInviteBox(QWidget*, not_null<ChannelData*> channel);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void prepare() override;
|
void prepare() override;
|
||||||
|
@ -112,7 +112,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
void updateSelected(const QPoint &cursorGlobalPosition);
|
void updateSelected(const QPoint &cursorGlobalPosition);
|
||||||
|
|
||||||
gsl::not_null<ChannelData*> _channel;
|
not_null<ChannelData*> _channel;
|
||||||
|
|
||||||
Text _text;
|
Text _text;
|
||||||
int32 _textWidth, _textHeight;
|
int32 _textWidth, _textHeight;
|
||||||
|
|
|
@ -75,7 +75,7 @@ void ApplyDependencies(CheckboxesMap &checkboxes, DependenciesMap &dependencies,
|
||||||
|
|
||||||
class EditParticipantBox::Inner : public TWidget {
|
class EditParticipantBox::Inner : public TWidget {
|
||||||
public:
|
public:
|
||||||
Inner(QWidget *parent, gsl::not_null<ChannelData*> channel, gsl::not_null<UserData*> user, bool hasAdminRights);
|
Inner(QWidget *parent, not_null<ChannelData*> channel, not_null<UserData*> user, bool hasAdminRights);
|
||||||
|
|
||||||
template <typename Widget>
|
template <typename Widget>
|
||||||
QPointer<Widget> addControl(object_ptr<Widget> widget, QMargins margin) {
|
QPointer<Widget> addControl(object_ptr<Widget> widget, QMargins margin) {
|
||||||
|
@ -92,8 +92,8 @@ protected:
|
||||||
private:
|
private:
|
||||||
void doAddControl(object_ptr<TWidget> widget, QMargins margin);
|
void doAddControl(object_ptr<TWidget> widget, QMargins margin);
|
||||||
|
|
||||||
gsl::not_null<ChannelData*> _channel;
|
not_null<ChannelData*> _channel;
|
||||||
gsl::not_null<UserData*> _user;
|
not_null<UserData*> _user;
|
||||||
object_ptr<Ui::PeerAvatarButton> _userPhoto;
|
object_ptr<Ui::PeerAvatarButton> _userPhoto;
|
||||||
Text _userName;
|
Text _userName;
|
||||||
bool _hasAdminRights = false;
|
bool _hasAdminRights = false;
|
||||||
|
@ -105,7 +105,7 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
EditParticipantBox::Inner::Inner(QWidget *parent, gsl::not_null<ChannelData*> channel, gsl::not_null<UserData*> user, bool hasAdminRights) : TWidget(parent)
|
EditParticipantBox::Inner::Inner(QWidget *parent, not_null<ChannelData*> channel, not_null<UserData*> user, bool hasAdminRights) : TWidget(parent)
|
||||||
, _channel(channel)
|
, _channel(channel)
|
||||||
, _user(user)
|
, _user(user)
|
||||||
, _userPhoto(this, _user, st::rightsPhotoButton)
|
, _userPhoto(this, _user, st::rightsPhotoButton)
|
||||||
|
@ -163,7 +163,7 @@ void EditParticipantBox::Inner::paintEvent(QPaintEvent *e) {
|
||||||
p.drawTextLeft(namex, st::rightsPhotoMargin.top() + st::rightsStatusTop, width(), statusText());
|
p.drawTextLeft(namex, st::rightsPhotoMargin.top() + st::rightsStatusTop, width(), statusText());
|
||||||
}
|
}
|
||||||
|
|
||||||
EditParticipantBox::EditParticipantBox(QWidget*, gsl::not_null<ChannelData*> channel, gsl::not_null<UserData*> user, bool hasAdminRights) : BoxContent()
|
EditParticipantBox::EditParticipantBox(QWidget*, not_null<ChannelData*> channel, not_null<UserData*> user, bool hasAdminRights) : BoxContent()
|
||||||
, _channel(channel)
|
, _channel(channel)
|
||||||
, _user(user)
|
, _user(user)
|
||||||
, _hasAdminRights(hasAdminRights) {
|
, _hasAdminRights(hasAdminRights) {
|
||||||
|
@ -189,7 +189,7 @@ void EditParticipantBox::resizeToContent() {
|
||||||
setDimensions(_inner->width(), qMin(_inner->height(), st::boxMaxListHeight));
|
setDimensions(_inner->width(), qMin(_inner->height(), st::boxMaxListHeight));
|
||||||
}
|
}
|
||||||
|
|
||||||
EditAdminBox::EditAdminBox(QWidget*, gsl::not_null<ChannelData*> channel, gsl::not_null<UserData*> user, const MTPChannelAdminRights &rights) : EditParticipantBox(nullptr, channel, user, (rights.c_channelAdminRights().vflags.v != 0))
|
EditAdminBox::EditAdminBox(QWidget*, not_null<ChannelData*> channel, not_null<UserData*> user, const MTPChannelAdminRights &rights) : EditParticipantBox(nullptr, channel, user, (rights.c_channelAdminRights().vflags.v != 0))
|
||||||
, _oldRights(rights) {
|
, _oldRights(rights) {
|
||||||
auto dependency = [this](Flag dependent, Flag dependency) {
|
auto dependency = [this](Flag dependent, Flag dependency) {
|
||||||
_dependencies.push_back(std::make_pair(dependent, dependency));
|
_dependencies.push_back(std::make_pair(dependent, dependency));
|
||||||
|
@ -198,7 +198,7 @@ EditAdminBox::EditAdminBox(QWidget*, gsl::not_null<ChannelData*> channel, gsl::n
|
||||||
dependency(Flag::f_invite_users, Flag::f_invite_link);
|
dependency(Flag::f_invite_users, Flag::f_invite_link);
|
||||||
}
|
}
|
||||||
|
|
||||||
MTPChannelAdminRights EditAdminBox::DefaultRights(gsl::not_null<ChannelData*> channel) {
|
MTPChannelAdminRights EditAdminBox::DefaultRights(not_null<ChannelData*> channel) {
|
||||||
auto defaultRights = channel->isMegagroup()
|
auto defaultRights = channel->isMegagroup()
|
||||||
? (Flag::f_change_info | Flag::f_delete_messages | Flag::f_ban_users | Flag::f_invite_users | Flag::f_invite_link | Flag::f_pin_messages)
|
? (Flag::f_change_info | Flag::f_delete_messages | Flag::f_ban_users | Flag::f_invite_users | Flag::f_invite_link | Flag::f_pin_messages)
|
||||||
: (Flag::f_change_info | Flag::f_post_messages | Flag::f_edit_messages | Flag::f_delete_messages | Flag::f_invite_users | Flag::f_invite_link);
|
: (Flag::f_change_info | Flag::f_post_messages | Flag::f_edit_messages | Flag::f_delete_messages | Flag::f_invite_users | Flag::f_invite_link);
|
||||||
|
@ -308,7 +308,7 @@ void EditAdminBox::refreshAboutAddAdminsText() {
|
||||||
resizeToContent();
|
resizeToContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
EditRestrictedBox::EditRestrictedBox(QWidget*, gsl::not_null<ChannelData*> channel, gsl::not_null<UserData*> user, bool hasAdminRights, const MTPChannelBannedRights &rights) : EditParticipantBox(nullptr, channel, user, hasAdminRights)
|
EditRestrictedBox::EditRestrictedBox(QWidget*, not_null<ChannelData*> channel, not_null<UserData*> user, bool hasAdminRights, const MTPChannelBannedRights &rights) : EditParticipantBox(nullptr, channel, user, hasAdminRights)
|
||||||
, _oldRights(rights) {
|
, _oldRights(rights) {
|
||||||
auto dependency = [this](Flag dependent, Flag dependency) {
|
auto dependency = [this](Flag dependent, Flag dependency) {
|
||||||
_dependencies.push_back(std::make_pair(dependent, dependency));
|
_dependencies.push_back(std::make_pair(dependent, dependency));
|
||||||
|
@ -391,7 +391,7 @@ void EditRestrictedBox::applyDependencies(QPointer<Ui::Checkbox> changed) {
|
||||||
ApplyDependencies(_checkboxes, _dependencies, changed);
|
ApplyDependencies(_checkboxes, _dependencies, changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
MTPChannelBannedRights EditRestrictedBox::DefaultRights(gsl::not_null<ChannelData*> channel) {
|
MTPChannelBannedRights EditRestrictedBox::DefaultRights(not_null<ChannelData*> channel) {
|
||||||
auto defaultRights = Flag::f_send_messages | Flag::f_send_media | Flag::f_embed_links | Flag::f_send_stickers | Flag::f_send_gifs | Flag::f_send_games | Flag::f_send_inline;
|
auto defaultRights = Flag::f_send_messages | Flag::f_send_media | Flag::f_embed_links | Flag::f_send_stickers | Flag::f_send_gifs | Flag::f_send_games | Flag::f_send_inline;
|
||||||
return MTP_channelBannedRights(MTP_flags(defaultRights), MTP_int(0));
|
return MTP_channelBannedRights(MTP_flags(defaultRights), MTP_int(0));
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,17 +34,17 @@ class CalendarBox;
|
||||||
|
|
||||||
class EditParticipantBox : public BoxContent {
|
class EditParticipantBox : public BoxContent {
|
||||||
public:
|
public:
|
||||||
EditParticipantBox(QWidget*, gsl::not_null<ChannelData*> channel, gsl::not_null<UserData*> user, bool hasAdminRights);
|
EditParticipantBox(QWidget*, not_null<ChannelData*> channel, not_null<UserData*> user, bool hasAdminRights);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void prepare() override;
|
void prepare() override;
|
||||||
|
|
||||||
void resizeToContent();
|
void resizeToContent();
|
||||||
|
|
||||||
gsl::not_null<UserData*> user() const {
|
not_null<UserData*> user() const {
|
||||||
return _user;
|
return _user;
|
||||||
}
|
}
|
||||||
gsl::not_null<ChannelData*> channel() const {
|
not_null<ChannelData*> channel() const {
|
||||||
return _channel;
|
return _channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,8 +58,8 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
gsl::not_null<ChannelData*> _channel;
|
not_null<ChannelData*> _channel;
|
||||||
gsl::not_null<UserData*> _user;
|
not_null<UserData*> _user;
|
||||||
bool _hasAdminRights = false;
|
bool _hasAdminRights = false;
|
||||||
|
|
||||||
class Inner;
|
class Inner;
|
||||||
|
@ -69,7 +69,7 @@ private:
|
||||||
|
|
||||||
class EditAdminBox : public EditParticipantBox {
|
class EditAdminBox : public EditParticipantBox {
|
||||||
public:
|
public:
|
||||||
EditAdminBox(QWidget*, gsl::not_null<ChannelData*> channel, gsl::not_null<UserData*> user, const MTPChannelAdminRights &rights);
|
EditAdminBox(QWidget*, not_null<ChannelData*> channel, not_null<UserData*> user, const MTPChannelAdminRights &rights);
|
||||||
|
|
||||||
void setSaveCallback(base::lambda<void(MTPChannelAdminRights, MTPChannelAdminRights)> callback) {
|
void setSaveCallback(base::lambda<void(MTPChannelAdminRights, MTPChannelAdminRights)> callback) {
|
||||||
_saveCallback = std::move(callback);
|
_saveCallback = std::move(callback);
|
||||||
|
@ -82,7 +82,7 @@ private:
|
||||||
using Flag = MTPDchannelAdminRights::Flag;
|
using Flag = MTPDchannelAdminRights::Flag;
|
||||||
using Flags = MTPDchannelAdminRights::Flags;
|
using Flags = MTPDchannelAdminRights::Flags;
|
||||||
|
|
||||||
static MTPChannelAdminRights DefaultRights(gsl::not_null<ChannelData*> channel);
|
static MTPChannelAdminRights DefaultRights(not_null<ChannelData*> channel);
|
||||||
|
|
||||||
bool canSave() const {
|
bool canSave() const {
|
||||||
return !!_saveCallback;
|
return !!_saveCallback;
|
||||||
|
@ -104,7 +104,7 @@ private:
|
||||||
|
|
||||||
class EditRestrictedBox : public EditParticipantBox {
|
class EditRestrictedBox : public EditParticipantBox {
|
||||||
public:
|
public:
|
||||||
EditRestrictedBox(QWidget*, gsl::not_null<ChannelData*> channel, gsl::not_null<UserData*> user, bool hasAdminRights, const MTPChannelBannedRights &rights);
|
EditRestrictedBox(QWidget*, not_null<ChannelData*> channel, not_null<UserData*> user, bool hasAdminRights, const MTPChannelBannedRights &rights);
|
||||||
|
|
||||||
void setSaveCallback(base::lambda<void(MTPChannelBannedRights, MTPChannelBannedRights)> callback) {
|
void setSaveCallback(base::lambda<void(MTPChannelBannedRights, MTPChannelBannedRights)> callback) {
|
||||||
_saveCallback = std::move(callback);
|
_saveCallback = std::move(callback);
|
||||||
|
@ -117,7 +117,7 @@ private:
|
||||||
using Flag = MTPDchannelBannedRights::Flag;
|
using Flag = MTPDchannelBannedRights::Flag;
|
||||||
using Flags = MTPDchannelBannedRights::Flags;
|
using Flags = MTPDchannelBannedRights::Flags;
|
||||||
|
|
||||||
static MTPChannelBannedRights DefaultRights(gsl::not_null<ChannelData*> channel);
|
static MTPChannelBannedRights DefaultRights(not_null<ChannelData*> channel);
|
||||||
|
|
||||||
bool canSave() const {
|
bool canSave() const {
|
||||||
return !!_saveCallback;
|
return !!_saveCallback;
|
||||||
|
|
|
@ -34,22 +34,22 @@ namespace {
|
||||||
|
|
||||||
class PrivacyExceptionsBoxController : public ChatsListBoxController {
|
class PrivacyExceptionsBoxController : public ChatsListBoxController {
|
||||||
public:
|
public:
|
||||||
PrivacyExceptionsBoxController(base::lambda<QString()> titleFactory, const std::vector<gsl::not_null<UserData*>> &selected);
|
PrivacyExceptionsBoxController(base::lambda<QString()> titleFactory, const std::vector<not_null<UserData*>> &selected);
|
||||||
void rowClicked(gsl::not_null<PeerListRow*> row) override;
|
void rowClicked(not_null<PeerListRow*> row) override;
|
||||||
|
|
||||||
std::vector<gsl::not_null<UserData*>> getResult() const;
|
std::vector<not_null<UserData*>> getResult() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void prepareViewHook() override;
|
void prepareViewHook() override;
|
||||||
std::unique_ptr<Row> createRow(gsl::not_null<History*> history) override;
|
std::unique_ptr<Row> createRow(not_null<History*> history) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
base::lambda<QString()> _titleFactory;
|
base::lambda<QString()> _titleFactory;
|
||||||
std::vector<gsl::not_null<UserData*>> _selected;
|
std::vector<not_null<UserData*>> _selected;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
PrivacyExceptionsBoxController::PrivacyExceptionsBoxController(base::lambda<QString()> titleFactory, const std::vector<gsl::not_null<UserData*>> &selected)
|
PrivacyExceptionsBoxController::PrivacyExceptionsBoxController(base::lambda<QString()> titleFactory, const std::vector<not_null<UserData*>> &selected)
|
||||||
: _titleFactory(std::move(titleFactory))
|
: _titleFactory(std::move(titleFactory))
|
||||||
, _selected(selected) {
|
, _selected(selected) {
|
||||||
}
|
}
|
||||||
|
@ -59,9 +59,9 @@ void PrivacyExceptionsBoxController::prepareViewHook() {
|
||||||
delegate()->peerListAddSelectedRows(_selected);
|
delegate()->peerListAddSelectedRows(_selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<gsl::not_null<UserData*>> PrivacyExceptionsBoxController::getResult() const {
|
std::vector<not_null<UserData*>> PrivacyExceptionsBoxController::getResult() const {
|
||||||
auto peers = delegate()->peerListCollectSelectedRows();
|
auto peers = delegate()->peerListCollectSelectedRows();
|
||||||
auto users = std::vector<gsl::not_null<UserData*>>();
|
auto users = std::vector<not_null<UserData*>>();
|
||||||
if (!peers.empty()) {
|
if (!peers.empty()) {
|
||||||
users.reserve(peers.size());
|
users.reserve(peers.size());
|
||||||
for_const (auto peer, peers) {
|
for_const (auto peer, peers) {
|
||||||
|
@ -73,11 +73,11 @@ std::vector<gsl::not_null<UserData*>> PrivacyExceptionsBoxController::getResult(
|
||||||
return users;
|
return users;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrivacyExceptionsBoxController::rowClicked(gsl::not_null<PeerListRow*> row) {
|
void PrivacyExceptionsBoxController::rowClicked(not_null<PeerListRow*> row) {
|
||||||
delegate()->peerListSetRowChecked(row, !row->checked());
|
delegate()->peerListSetRowChecked(row, !row->checked());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<PrivacyExceptionsBoxController::Row> PrivacyExceptionsBoxController::createRow(gsl::not_null<History*> history) {
|
std::unique_ptr<PrivacyExceptionsBoxController::Row> PrivacyExceptionsBoxController::createRow(not_null<History*> history) {
|
||||||
if (history->peer->isSelf()) {
|
if (history->peer->isSelf()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ void EditPrivacyBox::editExceptionUsers(Exception exception) {
|
||||||
auto controller = std::make_unique<PrivacyExceptionsBoxController>(base::lambda_guarded(this, [this, exception] {
|
auto controller = std::make_unique<PrivacyExceptionsBoxController>(base::lambda_guarded(this, [this, exception] {
|
||||||
return _controller->exceptionBoxTitle(exception);
|
return _controller->exceptionBoxTitle(exception);
|
||||||
}), exceptionUsers(exception));
|
}), exceptionUsers(exception));
|
||||||
auto initBox = [this, exception, controller = controller.get()](gsl::not_null<PeerListBox*> box) {
|
auto initBox = [this, exception, controller = controller.get()](not_null<PeerListBox*> box) {
|
||||||
box->addButton(langFactory(lng_settings_save), base::lambda_guarded(this, [this, box, exception, controller] {
|
box->addButton(langFactory(lng_settings_save), base::lambda_guarded(this, [this, box, exception, controller] {
|
||||||
exceptionUsers(exception) = controller->getResult();
|
exceptionUsers(exception) = controller->getResult();
|
||||||
exceptionLink(exception)->entity()->setText(exceptionLinkText(exception));
|
exceptionLink(exception)->entity()->setText(exceptionLinkText(exception));
|
||||||
|
@ -244,7 +244,7 @@ style::margins EditPrivacyBox::exceptionLinkMargins() const {
|
||||||
return st::editPrivacyLinkMargin;
|
return st::editPrivacyLinkMargin;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<gsl::not_null<UserData*>> &EditPrivacyBox::exceptionUsers(Exception exception) {
|
std::vector<not_null<UserData*>> &EditPrivacyBox::exceptionUsers(Exception exception) {
|
||||||
switch (exception) {
|
switch (exception) {
|
||||||
case Exception::Always: return _alwaysUsers;
|
case Exception::Always: return _alwaysUsers;
|
||||||
case Exception::Never: return _neverUsers;
|
case Exception::Never: return _neverUsers;
|
||||||
|
|
|
@ -102,7 +102,7 @@ private:
|
||||||
|
|
||||||
void editExceptionUsers(Exception exception);
|
void editExceptionUsers(Exception exception);
|
||||||
QString exceptionLinkText(Exception exception);
|
QString exceptionLinkText(Exception exception);
|
||||||
std::vector<gsl::not_null<UserData*>> &exceptionUsers(Exception exception);
|
std::vector<not_null<UserData*>> &exceptionUsers(Exception exception);
|
||||||
object_ptr<Ui::WidgetSlideWrap<Ui::LinkButton>> &exceptionLink(Exception exception);
|
object_ptr<Ui::WidgetSlideWrap<Ui::LinkButton>> &exceptionLink(Exception exception);
|
||||||
|
|
||||||
std::unique_ptr<Controller> _controller;
|
std::unique_ptr<Controller> _controller;
|
||||||
|
@ -120,7 +120,7 @@ private:
|
||||||
object_ptr<Ui::WidgetSlideWrap<Ui::LinkButton>> _neverLink = { nullptr };
|
object_ptr<Ui::WidgetSlideWrap<Ui::LinkButton>> _neverLink = { nullptr };
|
||||||
object_ptr<Ui::FlatLabel> _exceptionsDescription = { nullptr };
|
object_ptr<Ui::FlatLabel> _exceptionsDescription = { nullptr };
|
||||||
|
|
||||||
std::vector<gsl::not_null<UserData*>> _alwaysUsers;
|
std::vector<not_null<UserData*>> _alwaysUsers;
|
||||||
std::vector<gsl::not_null<UserData*>> _neverUsers;
|
std::vector<not_null<UserData*>> _neverUsers;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,7 +33,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
|
|
||||||
class LanguageBox::Inner : public TWidget, private base::Subscriber {
|
class LanguageBox::Inner : public TWidget, private base::Subscriber {
|
||||||
public:
|
public:
|
||||||
Inner(QWidget *parent, gsl::not_null<Languages*> languages);
|
Inner(QWidget *parent, not_null<Languages*> languages);
|
||||||
|
|
||||||
void setSelected(int index);
|
void setSelected(int index);
|
||||||
void refresh();
|
void refresh();
|
||||||
|
@ -42,13 +42,13 @@ private:
|
||||||
void activateCurrent();
|
void activateCurrent();
|
||||||
void languageChanged(int languageIndex);
|
void languageChanged(int languageIndex);
|
||||||
|
|
||||||
gsl::not_null<Languages*> _languages;
|
not_null<Languages*> _languages;
|
||||||
std::shared_ptr<Ui::RadiobuttonGroup> _group;
|
std::shared_ptr<Ui::RadiobuttonGroup> _group;
|
||||||
std::vector<object_ptr<Ui::Radiobutton>> _buttons;
|
std::vector<object_ptr<Ui::Radiobutton>> _buttons;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
LanguageBox::Inner::Inner(QWidget *parent, gsl::not_null<Languages*> languages) : TWidget(parent)
|
LanguageBox::Inner::Inner(QWidget *parent, not_null<Languages*> languages) : TWidget(parent)
|
||||||
, _languages(languages) {
|
, _languages(languages) {
|
||||||
_group = std::make_shared<Ui::RadiobuttonGroup>(0);
|
_group = std::make_shared<Ui::RadiobuttonGroup>(0);
|
||||||
_group->setChangedCallback([this](int value) { languageChanged(value); });
|
_group->setChangedCallback([this](int value) { languageChanged(value); });
|
||||||
|
|
|
@ -15,7 +15,7 @@ class MuteSettingsBox : public BoxContent {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MuteSettingsBox(QWidget *parent, gsl::not_null<PeerData*> peer)
|
MuteSettingsBox(QWidget *parent, not_null<PeerData*> peer)
|
||||||
: _peer(peer) {
|
: _peer(peer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,6 @@ class MuteSettingsBox : public BoxContent {
|
||||||
void prepare() override;
|
void prepare() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
gsl::not_null<PeerData*> _peer;
|
not_null<PeerData*> _peer;
|
||||||
};
|
};
|
||||||
// vi: ts=4 tw=80
|
// vi: ts=4 tw=80
|
||||||
|
|
|
@ -34,7 +34,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "storage/file_download.h"
|
#include "storage/file_download.h"
|
||||||
#include "window/themes/window_theme.h"
|
#include "window/themes/window_theme.h"
|
||||||
|
|
||||||
PeerListBox::PeerListBox(QWidget*, std::unique_ptr<PeerListController> controller, base::lambda<void(gsl::not_null<PeerListBox*>)> init)
|
PeerListBox::PeerListBox(QWidget*, std::unique_ptr<PeerListController> controller, base::lambda<void(not_null<PeerListBox*>)> init)
|
||||||
: _controller(std::move(controller))
|
: _controller(std::move(controller))
|
||||||
, _init(std::move(init)) {
|
, _init(std::move(init)) {
|
||||||
Expects(_controller != nullptr);
|
Expects(_controller != nullptr);
|
||||||
|
@ -155,7 +155,7 @@ void PeerListBox::peerListAppendSearchRow(std::unique_ptr<PeerListRow> row) {
|
||||||
_inner->appendSearchRow(std::move(row));
|
_inner->appendSearchRow(std::move(row));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerListBox::peerListAppendFoundRow(gsl::not_null<PeerListRow*> row) {
|
void PeerListBox::peerListAppendFoundRow(not_null<PeerListRow*> row) {
|
||||||
_inner->appendFoundRow(row);
|
_inner->appendFoundRow(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ void PeerListBox::peerListPrependRow(std::unique_ptr<PeerListRow> row) {
|
||||||
_inner->prependRow(std::move(row));
|
_inner->prependRow(std::move(row));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerListBox::peerListPrependRowFromSearchResult(gsl::not_null<PeerListRow*> row) {
|
void PeerListBox::peerListPrependRowFromSearchResult(not_null<PeerListRow*> row) {
|
||||||
_inner->prependRowFromSearchResult(row);
|
_inner->prependRowFromSearchResult(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,19 +171,19 @@ PeerListRow *PeerListBox::peerListFindRow(PeerListRowId id) {
|
||||||
return _inner->findRow(id);
|
return _inner->findRow(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerListBox::peerListUpdateRow(gsl::not_null<PeerListRow*> row) {
|
void PeerListBox::peerListUpdateRow(not_null<PeerListRow*> row) {
|
||||||
_inner->updateRow(row);
|
_inner->updateRow(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerListBox::peerListRemoveRow(gsl::not_null<PeerListRow*> row) {
|
void PeerListBox::peerListRemoveRow(not_null<PeerListRow*> row) {
|
||||||
_inner->removeRow(row);
|
_inner->removeRow(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerListBox::peerListConvertRowToSearchResult(gsl::not_null<PeerListRow*> row) {
|
void PeerListBox::peerListConvertRowToSearchResult(not_null<PeerListRow*> row) {
|
||||||
_inner->convertRowToSearchResult(row);
|
_inner->convertRowToSearchResult(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerListBox::peerListSetRowChecked(gsl::not_null<PeerListRow*> row, bool checked) {
|
void PeerListBox::peerListSetRowChecked(not_null<PeerListRow*> row, bool checked) {
|
||||||
auto peer = row->peer();
|
auto peer = row->peer();
|
||||||
if (checked) {
|
if (checked) {
|
||||||
addSelectItem(peer, PeerListRow::SetStyle::Animated);
|
addSelectItem(peer, PeerListRow::SetStyle::Animated);
|
||||||
|
@ -203,7 +203,7 @@ int PeerListBox::peerListFullRowsCount() {
|
||||||
return _inner->fullRowsCount();
|
return _inner->fullRowsCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
gsl::not_null<PeerListRow*> PeerListBox::peerListRowAt(int index) {
|
not_null<PeerListRow*> PeerListBox::peerListRowAt(int index) {
|
||||||
return _inner->rowAt(index);
|
return _inner->rowAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ void PeerListController::search(const QString &query) {
|
||||||
_searchController->searchQuery(query);
|
_searchController->searchQuery(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerListController::peerListSearchAddRow(gsl::not_null<PeerData*> peer) {
|
void PeerListController::peerListSearchAddRow(not_null<PeerData*> peer) {
|
||||||
if (auto row = delegate()->peerListFindRow(peer->id)) {
|
if (auto row = delegate()->peerListFindRow(peer->id)) {
|
||||||
t_assert(row->id() == row->peer()->id);
|
t_assert(row->id() == row->peer()->id);
|
||||||
delegate()->peerListAppendFoundRow(row);
|
delegate()->peerListAppendFoundRow(row);
|
||||||
|
@ -314,7 +314,7 @@ void PeerListController::setSearchNoResultsText(const QString &text) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerListBox::addSelectItem(gsl::not_null<PeerData*> peer, PeerListRow::SetStyle style) {
|
void PeerListBox::addSelectItem(not_null<PeerData*> peer, PeerListRow::SetStyle style) {
|
||||||
if (!_select) {
|
if (!_select) {
|
||||||
createMultiSelect();
|
createMultiSelect();
|
||||||
_select->toggleFast(false);
|
_select->toggleFast(false);
|
||||||
|
@ -331,7 +331,7 @@ void PeerListBox::peerListFinishSelectedRowsBunch() {
|
||||||
_select->entity()->finishItemsBunch();
|
_select->entity()->finishItemsBunch();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PeerListBox::peerListIsRowSelected(gsl::not_null<PeerData*> peer) {
|
bool PeerListBox::peerListIsRowSelected(not_null<PeerData*> peer) {
|
||||||
return _select ? _select->entity()->hasItem(peer->id) : false;
|
return _select ? _select->entity()->hasItem(peer->id) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,9 +340,9 @@ int PeerListBox::peerListSelectedRowsCount() {
|
||||||
return _select->entity()->getItemsCount();
|
return _select->entity()->getItemsCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<gsl::not_null<PeerData*>> PeerListBox::peerListCollectSelectedRows() {
|
std::vector<not_null<PeerData*>> PeerListBox::peerListCollectSelectedRows() {
|
||||||
Expects(_select != nullptr);
|
Expects(_select != nullptr);
|
||||||
auto result = std::vector<gsl::not_null<PeerData*>>();
|
auto result = std::vector<not_null<PeerData*>>();
|
||||||
auto items = _select->entity()->getItems();
|
auto items = _select->entity()->getItems();
|
||||||
if (!items.empty()) {
|
if (!items.empty()) {
|
||||||
result.reserve(items.size());
|
result.reserve(items.size());
|
||||||
|
@ -353,10 +353,10 @@ std::vector<gsl::not_null<PeerData*>> PeerListBox::peerListCollectSelectedRows()
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
PeerListRow::PeerListRow(gsl::not_null<PeerData*> peer) : PeerListRow(peer, peer->id) {
|
PeerListRow::PeerListRow(not_null<PeerData*> peer) : PeerListRow(peer, peer->id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
PeerListRow::PeerListRow(gsl::not_null<PeerData*> peer, PeerListRowId id)
|
PeerListRow::PeerListRow(not_null<PeerData*> peer, PeerListRowId id)
|
||||||
: _id(id)
|
: _id(id)
|
||||||
, _peer(peer)
|
, _peer(peer)
|
||||||
, _initialized(false)
|
, _initialized(false)
|
||||||
|
@ -522,7 +522,7 @@ void PeerListRow::setCheckedInternal(bool checked, SetStyle style) {
|
||||||
_checkbox->setChecked(checked, speed);
|
_checkbox->setChecked(checked, speed);
|
||||||
}
|
}
|
||||||
|
|
||||||
PeerListBox::Inner::Inner(QWidget *parent, gsl::not_null<PeerListController*> controller) : TWidget(parent)
|
PeerListBox::Inner::Inner(QWidget *parent, not_null<PeerListController*> controller) : TWidget(parent)
|
||||||
, _controller(controller)
|
, _controller(controller)
|
||||||
, _rowHeight(st::contactsPadding.top() + st::contactsPhotoSize + st::contactsPadding.bottom()) {
|
, _rowHeight(st::contactsPadding.top() + st::contactsPhotoSize + st::contactsPadding.bottom()) {
|
||||||
subscribe(Auth().downloaderTaskFinished(), [this] { update(); });
|
subscribe(Auth().downloaderTaskFinished(), [this] { update(); });
|
||||||
|
@ -564,7 +564,7 @@ void PeerListBox::Inner::appendSearchRow(std::unique_ptr<PeerListRow> row) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerListBox::Inner::appendFoundRow(gsl::not_null<PeerListRow*> row) {
|
void PeerListBox::Inner::appendFoundRow(not_null<PeerListRow*> row) {
|
||||||
Expects(showingSearch());
|
Expects(showingSearch());
|
||||||
auto index = findRowIndex(row);
|
auto index = findRowIndex(row);
|
||||||
if (index.value < 0) {
|
if (index.value < 0) {
|
||||||
|
@ -572,13 +572,13 @@ void PeerListBox::Inner::appendFoundRow(gsl::not_null<PeerListRow*> row) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerListBox::Inner::changeCheckState(gsl::not_null<PeerListRow*> row, bool checked, PeerListRow::SetStyle style) {
|
void PeerListBox::Inner::changeCheckState(not_null<PeerListRow*> row, bool checked, PeerListRow::SetStyle style) {
|
||||||
row->setChecked(checked, style, [this, row] {
|
row->setChecked(checked, style, [this, row] {
|
||||||
updateRow(row);
|
updateRow(row);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerListBox::Inner::addRowEntry(gsl::not_null<PeerListRow*> row) {
|
void PeerListBox::Inner::addRowEntry(not_null<PeerListRow*> row) {
|
||||||
_rowsById.emplace(row->id(), row);
|
_rowsById.emplace(row->id(), row);
|
||||||
_rowsByPeer[row->peer()].push_back(row);
|
_rowsByPeer[row->peer()].push_back(row);
|
||||||
if (addingToSearchIndex()) {
|
if (addingToSearchIndex()) {
|
||||||
|
@ -601,7 +601,7 @@ bool PeerListBox::Inner::addingToSearchIndex() const {
|
||||||
return (_searchMode != PeerListSearchMode::Disabled) || !_searchIndex.empty();
|
return (_searchMode != PeerListSearchMode::Disabled) || !_searchIndex.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerListBox::Inner::addToSearchIndex(gsl::not_null<PeerListRow*> row) {
|
void PeerListBox::Inner::addToSearchIndex(not_null<PeerListRow*> row) {
|
||||||
if (row->isSearchResult()) {
|
if (row->isSearchResult()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -613,7 +613,7 @@ void PeerListBox::Inner::addToSearchIndex(gsl::not_null<PeerListRow*> row) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerListBox::Inner::removeFromSearchIndex(gsl::not_null<PeerListRow*> row) {
|
void PeerListBox::Inner::removeFromSearchIndex(not_null<PeerListRow*> row) {
|
||||||
auto &nameFirstChars = row->nameFirstChars();
|
auto &nameFirstChars = row->nameFirstChars();
|
||||||
if (!nameFirstChars.empty()) {
|
if (!nameFirstChars.empty()) {
|
||||||
for_const (auto ch, row->nameFirstChars()) {
|
for_const (auto ch, row->nameFirstChars()) {
|
||||||
|
@ -639,7 +639,7 @@ void PeerListBox::Inner::prependRow(std::unique_ptr<PeerListRow> row) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerListBox::Inner::prependRowFromSearchResult(gsl::not_null<PeerListRow*> row) {
|
void PeerListBox::Inner::prependRowFromSearchResult(not_null<PeerListRow*> row) {
|
||||||
if (!row->isSearchResult()) {
|
if (!row->isSearchResult()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -677,7 +677,7 @@ PeerListRow *PeerListBox::Inner::findRow(PeerListRowId id) {
|
||||||
return (it == _rowsById.cend()) ? nullptr : it->second.get();
|
return (it == _rowsById.cend()) ? nullptr : it->second.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerListBox::Inner::removeRow(gsl::not_null<PeerListRow*> row) {
|
void PeerListBox::Inner::removeRow(not_null<PeerListRow*> row) {
|
||||||
auto index = row->absoluteIndex();
|
auto index = row->absoluteIndex();
|
||||||
auto isSearchResult = row->isSearchResult();
|
auto isSearchResult = row->isSearchResult();
|
||||||
auto &eraseFrom = isSearchResult ? _searchRows : _rows;
|
auto &eraseFrom = isSearchResult ? _searchRows : _rows;
|
||||||
|
@ -698,7 +698,7 @@ void PeerListBox::Inner::removeRow(gsl::not_null<PeerListRow*> row) {
|
||||||
restoreSelection();
|
restoreSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerListBox::Inner::convertRowToSearchResult(gsl::not_null<PeerListRow*> row) {
|
void PeerListBox::Inner::convertRowToSearchResult(not_null<PeerListRow*> row) {
|
||||||
if (row->isSearchResult()) {
|
if (row->isSearchResult()) {
|
||||||
return;
|
return;
|
||||||
} else if (!showingSearch() || !_controller->hasComplexSearch()) {
|
} else if (!showingSearch() || !_controller->hasComplexSearch()) {
|
||||||
|
@ -719,7 +719,7 @@ int PeerListBox::Inner::fullRowsCount() const {
|
||||||
return _rows.size();
|
return _rows.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
gsl::not_null<PeerListRow*> PeerListBox::Inner::rowAt(int index) const {
|
not_null<PeerListRow*> PeerListBox::Inner::rowAt(int index) const {
|
||||||
Expects(index >= 0 && index < _rows.size());
|
Expects(index >= 0 && index < _rows.size());
|
||||||
return _rows[index].get();
|
return _rows[index].get();
|
||||||
}
|
}
|
||||||
|
@ -1001,7 +1001,7 @@ void PeerListBox::Inner::selectSkip(int direction) {
|
||||||
auto rowsCount = shownRowsCount();
|
auto rowsCount = shownRowsCount();
|
||||||
auto index = 0;
|
auto index = 0;
|
||||||
auto firstEnabled = -1, lastEnabled = -1;
|
auto firstEnabled = -1, lastEnabled = -1;
|
||||||
enumerateShownRows([&firstEnabled, &lastEnabled, &index](gsl::not_null<PeerListRow*> row) {
|
enumerateShownRows([&firstEnabled, &lastEnabled, &index](not_null<PeerListRow*> row) {
|
||||||
if (!row->disabled()) {
|
if (!row->disabled()) {
|
||||||
if (firstEnabled < 0) {
|
if (firstEnabled < 0) {
|
||||||
firstEnabled = index;
|
firstEnabled = index;
|
||||||
|
@ -1098,7 +1098,7 @@ void PeerListBox::Inner::searchQueryChanged(QString query) {
|
||||||
if (_normalizedSearchQuery != normalizedQuery) {
|
if (_normalizedSearchQuery != normalizedQuery) {
|
||||||
setSearchQuery(query, normalizedQuery);
|
setSearchQuery(query, normalizedQuery);
|
||||||
if (_controller->searchInLocal() && !searchWordsList.isEmpty()) {
|
if (_controller->searchInLocal() && !searchWordsList.isEmpty()) {
|
||||||
auto minimalList = (const std::vector<gsl::not_null<PeerListRow*>>*)nullptr;
|
auto minimalList = (const std::vector<not_null<PeerListRow*>>*)nullptr;
|
||||||
for_const (auto &searchWord, searchWordsList) {
|
for_const (auto &searchWord, searchWordsList) {
|
||||||
auto searchWordStart = searchWord[0].toLower();
|
auto searchWordStart = searchWord[0].toLower();
|
||||||
auto it = _searchIndex.find(searchWordStart);
|
auto it = _searchIndex.find(searchWordStart);
|
||||||
|
@ -1202,7 +1202,7 @@ void PeerListBox::Inner::updateSelection() {
|
||||||
setSelected(selected);
|
setSelected(selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect PeerListBox::Inner::getActionRect(gsl::not_null<PeerListRow*> row, RowIndex index) const {
|
QRect PeerListBox::Inner::getActionRect(not_null<PeerListRow*> row, RowIndex index) const {
|
||||||
auto actionSize = row->actionSize();
|
auto actionSize = row->actionSize();
|
||||||
if (actionSize.isEmpty()) {
|
if (actionSize.isEmpty()) {
|
||||||
return QRect();
|
return QRect();
|
||||||
|
@ -1226,7 +1226,7 @@ int PeerListBox::Inner::getRowTop(RowIndex index) const {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerListBox::Inner::updateRow(gsl::not_null<PeerListRow*> row, RowIndex hint) {
|
void PeerListBox::Inner::updateRow(not_null<PeerListRow*> row, RowIndex hint) {
|
||||||
updateRow(findRowIndex(row, hint));
|
updateRow(findRowIndex(row, hint));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1286,7 +1286,7 @@ PeerListRow *PeerListBox::Inner::getRow(RowIndex index) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
PeerListBox::Inner::RowIndex PeerListBox::Inner::findRowIndex(gsl::not_null<PeerListRow*> row, RowIndex hint) {
|
PeerListBox::Inner::RowIndex PeerListBox::Inner::findRowIndex(not_null<PeerListRow*> row, RowIndex hint) {
|
||||||
if (!showingSearch()) {
|
if (!showingSearch()) {
|
||||||
t_assert(!row->isSearchResult());
|
t_assert(!row->isSearchResult());
|
||||||
return RowIndex(row->absoluteIndex());
|
return RowIndex(row->absoluteIndex());
|
||||||
|
|
|
@ -46,8 +46,8 @@ inline auto PaintUserpicCallback(PeerData *peer) {
|
||||||
using PeerListRowId = uint64;
|
using PeerListRowId = uint64;
|
||||||
class PeerListRow {
|
class PeerListRow {
|
||||||
public:
|
public:
|
||||||
PeerListRow(gsl::not_null<PeerData*> peer);
|
PeerListRow(not_null<PeerData*> peer);
|
||||||
PeerListRow(gsl::not_null<PeerData*> peer, PeerListRowId id);
|
PeerListRow(not_null<PeerData*> peer, PeerListRowId id);
|
||||||
|
|
||||||
enum class State {
|
enum class State {
|
||||||
Active,
|
Active,
|
||||||
|
@ -64,7 +64,7 @@ public:
|
||||||
// added to the box it is always false.
|
// added to the box it is always false.
|
||||||
bool checked() const;
|
bool checked() const;
|
||||||
|
|
||||||
gsl::not_null<PeerData*> peer() const {
|
not_null<PeerData*> peer() const {
|
||||||
return _peer;
|
return _peer;
|
||||||
}
|
}
|
||||||
PeerListRowId id() const {
|
PeerListRowId id() const {
|
||||||
|
@ -163,7 +163,7 @@ private:
|
||||||
void setStatusText(const QString &text);
|
void setStatusText(const QString &text);
|
||||||
|
|
||||||
PeerListRowId _id = 0;
|
PeerListRowId _id = 0;
|
||||||
gsl::not_null<PeerData*> _peer;
|
not_null<PeerData*> _peer;
|
||||||
std::unique_ptr<Ui::RippleAnimation> _ripple;
|
std::unique_ptr<Ui::RippleAnimation> _ripple;
|
||||||
std::unique_ptr<Ui::RoundImageCheckbox> _checkbox;
|
std::unique_ptr<Ui::RoundImageCheckbox> _checkbox;
|
||||||
Text _name;
|
Text _name;
|
||||||
|
@ -193,15 +193,15 @@ public:
|
||||||
virtual void peerListSetSearchMode(PeerListSearchMode mode) = 0;
|
virtual void peerListSetSearchMode(PeerListSearchMode mode) = 0;
|
||||||
virtual void peerListAppendRow(std::unique_ptr<PeerListRow> row) = 0;
|
virtual void peerListAppendRow(std::unique_ptr<PeerListRow> row) = 0;
|
||||||
virtual void peerListAppendSearchRow(std::unique_ptr<PeerListRow> row) = 0;
|
virtual void peerListAppendSearchRow(std::unique_ptr<PeerListRow> row) = 0;
|
||||||
virtual void peerListAppendFoundRow(gsl::not_null<PeerListRow*> row) = 0;
|
virtual void peerListAppendFoundRow(not_null<PeerListRow*> row) = 0;
|
||||||
virtual void peerListPrependRow(std::unique_ptr<PeerListRow> row) = 0;
|
virtual void peerListPrependRow(std::unique_ptr<PeerListRow> row) = 0;
|
||||||
virtual void peerListPrependRowFromSearchResult(gsl::not_null<PeerListRow*> row) = 0;
|
virtual void peerListPrependRowFromSearchResult(not_null<PeerListRow*> row) = 0;
|
||||||
virtual void peerListUpdateRow(gsl::not_null<PeerListRow*> row) = 0;
|
virtual void peerListUpdateRow(not_null<PeerListRow*> row) = 0;
|
||||||
virtual void peerListRemoveRow(gsl::not_null<PeerListRow*> row) = 0;
|
virtual void peerListRemoveRow(not_null<PeerListRow*> row) = 0;
|
||||||
virtual void peerListConvertRowToSearchResult(gsl::not_null<PeerListRow*> row) = 0;
|
virtual void peerListConvertRowToSearchResult(not_null<PeerListRow*> row) = 0;
|
||||||
virtual bool peerListIsRowSelected(gsl::not_null<PeerData*> peer) = 0;
|
virtual bool peerListIsRowSelected(not_null<PeerData*> peer) = 0;
|
||||||
virtual void peerListSetRowChecked(gsl::not_null<PeerListRow*> row, bool checked) = 0;
|
virtual void peerListSetRowChecked(not_null<PeerListRow*> row, bool checked) = 0;
|
||||||
virtual gsl::not_null<PeerListRow*> peerListRowAt(int index) = 0;
|
virtual not_null<PeerListRow*> peerListRowAt(int index) = 0;
|
||||||
virtual void peerListRefreshRows() = 0;
|
virtual void peerListRefreshRows() = 0;
|
||||||
virtual void peerListScrollToTop() = 0;
|
virtual void peerListScrollToTop() = 0;
|
||||||
virtual int peerListFullRowsCount() = 0;
|
virtual int peerListFullRowsCount() = 0;
|
||||||
|
@ -218,18 +218,18 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int peerListSelectedRowsCount() = 0;
|
virtual int peerListSelectedRowsCount() = 0;
|
||||||
virtual std::vector<gsl::not_null<PeerData*>> peerListCollectSelectedRows() = 0;
|
virtual std::vector<not_null<PeerData*>> peerListCollectSelectedRows() = 0;
|
||||||
virtual ~PeerListDelegate() = default;
|
virtual ~PeerListDelegate() = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void peerListAddSelectedRowInBunch(gsl::not_null<PeerData*> peer) = 0;
|
virtual void peerListAddSelectedRowInBunch(not_null<PeerData*> peer) = 0;
|
||||||
virtual void peerListFinishSelectedRowsBunch() = 0;
|
virtual void peerListFinishSelectedRowsBunch() = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PeerListSearchDelegate {
|
class PeerListSearchDelegate {
|
||||||
public:
|
public:
|
||||||
virtual void peerListSearchAddRow(gsl::not_null<PeerData*> peer) = 0;
|
virtual void peerListSearchAddRow(not_null<PeerData*> peer) = 0;
|
||||||
virtual void peerListSearchRefreshRows() = 0;
|
virtual void peerListSearchRefreshRows() = 0;
|
||||||
virtual ~PeerListSearchDelegate() = default;
|
virtual ~PeerListSearchDelegate() = default;
|
||||||
|
|
||||||
|
@ -242,12 +242,12 @@ public:
|
||||||
virtual bool loadMoreRows() = 0;
|
virtual bool loadMoreRows() = 0;
|
||||||
virtual ~PeerListSearchController() = default;
|
virtual ~PeerListSearchController() = default;
|
||||||
|
|
||||||
void setDelegate(gsl::not_null<PeerListSearchDelegate*> delegate) {
|
void setDelegate(not_null<PeerListSearchDelegate*> delegate) {
|
||||||
_delegate = delegate;
|
_delegate = delegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
gsl::not_null<PeerListSearchDelegate*> delegate() const {
|
not_null<PeerListSearchDelegate*> delegate() const {
|
||||||
return _delegate;
|
return _delegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,27 +261,27 @@ public:
|
||||||
// Search works only with RowId == peer->id.
|
// Search works only with RowId == peer->id.
|
||||||
PeerListController(std::unique_ptr<PeerListSearchController> searchController = nullptr);
|
PeerListController(std::unique_ptr<PeerListSearchController> searchController = nullptr);
|
||||||
|
|
||||||
void setDelegate(gsl::not_null<PeerListDelegate*> delegate) {
|
void setDelegate(not_null<PeerListDelegate*> delegate) {
|
||||||
_delegate = delegate;
|
_delegate = delegate;
|
||||||
prepare();
|
prepare();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void prepare() = 0;
|
virtual void prepare() = 0;
|
||||||
virtual void rowClicked(gsl::not_null<PeerListRow*> row) = 0;
|
virtual void rowClicked(not_null<PeerListRow*> row) = 0;
|
||||||
virtual void rowActionClicked(gsl::not_null<PeerListRow*> row) {
|
virtual void rowActionClicked(not_null<PeerListRow*> row) {
|
||||||
}
|
}
|
||||||
virtual void loadMoreRows() {
|
virtual void loadMoreRows() {
|
||||||
}
|
}
|
||||||
virtual void itemDeselectedHook(gsl::not_null<PeerData*> peer) {
|
virtual void itemDeselectedHook(not_null<PeerData*> peer) {
|
||||||
}
|
}
|
||||||
bool isSearchLoading() const {
|
bool isSearchLoading() const {
|
||||||
return _searchController ? _searchController->isLoading() : false;
|
return _searchController ? _searchController->isLoading() : false;
|
||||||
}
|
}
|
||||||
virtual std::unique_ptr<PeerListRow> createSearchRow(gsl::not_null<PeerData*> peer) {
|
virtual std::unique_ptr<PeerListRow> createSearchRow(not_null<PeerData*> peer) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isRowSelected(gsl::not_null<PeerData*> peer) {
|
bool isRowSelected(not_null<PeerData*> peer) {
|
||||||
return delegate()->peerListIsRowSelected(peer);
|
return delegate()->peerListIsRowSelected(peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,13 +291,13 @@ public:
|
||||||
bool hasComplexSearch() const;
|
bool hasComplexSearch() const;
|
||||||
void search(const QString &query);
|
void search(const QString &query);
|
||||||
|
|
||||||
void peerListSearchAddRow(gsl::not_null<PeerData*> peer) override;
|
void peerListSearchAddRow(not_null<PeerData*> peer) override;
|
||||||
void peerListSearchRefreshRows() override;
|
void peerListSearchRefreshRows() override;
|
||||||
|
|
||||||
virtual ~PeerListController() = default;
|
virtual ~PeerListController() = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
gsl::not_null<PeerListDelegate*> delegate() const {
|
not_null<PeerListDelegate*> delegate() const {
|
||||||
return _delegate;
|
return _delegate;
|
||||||
}
|
}
|
||||||
PeerListSearchController *searchController() const {
|
PeerListSearchController *searchController() const {
|
||||||
|
@ -325,7 +325,7 @@ private:
|
||||||
|
|
||||||
class PeerListBox : public BoxContent, public PeerListDelegate {
|
class PeerListBox : public BoxContent, public PeerListDelegate {
|
||||||
public:
|
public:
|
||||||
PeerListBox(QWidget*, std::unique_ptr<PeerListController> controller, base::lambda<void(gsl::not_null<PeerListBox*>)> init);
|
PeerListBox(QWidget*, std::unique_ptr<PeerListController> controller, base::lambda<void(not_null<PeerListBox*>)> init);
|
||||||
|
|
||||||
void peerListSetTitle(base::lambda<QString()> title) override {
|
void peerListSetTitle(base::lambda<QString()> title) override {
|
||||||
setTitle(std::move(title));
|
setTitle(std::move(title));
|
||||||
|
@ -340,17 +340,17 @@ public:
|
||||||
void peerListSetSearchMode(PeerListSearchMode mode) override;
|
void peerListSetSearchMode(PeerListSearchMode mode) override;
|
||||||
void peerListAppendRow(std::unique_ptr<PeerListRow> row) override;
|
void peerListAppendRow(std::unique_ptr<PeerListRow> row) override;
|
||||||
void peerListAppendSearchRow(std::unique_ptr<PeerListRow> row) override;
|
void peerListAppendSearchRow(std::unique_ptr<PeerListRow> row) override;
|
||||||
void peerListAppendFoundRow(gsl::not_null<PeerListRow*> row) override;
|
void peerListAppendFoundRow(not_null<PeerListRow*> row) override;
|
||||||
void peerListPrependRow(std::unique_ptr<PeerListRow> row) override;
|
void peerListPrependRow(std::unique_ptr<PeerListRow> row) override;
|
||||||
void peerListPrependRowFromSearchResult(gsl::not_null<PeerListRow*> row) override;
|
void peerListPrependRowFromSearchResult(not_null<PeerListRow*> row) override;
|
||||||
void peerListUpdateRow(gsl::not_null<PeerListRow*> row) override;
|
void peerListUpdateRow(not_null<PeerListRow*> row) override;
|
||||||
void peerListRemoveRow(gsl::not_null<PeerListRow*> row) override;
|
void peerListRemoveRow(not_null<PeerListRow*> row) override;
|
||||||
void peerListConvertRowToSearchResult(gsl::not_null<PeerListRow*> row) override;
|
void peerListConvertRowToSearchResult(not_null<PeerListRow*> row) override;
|
||||||
void peerListSetRowChecked(gsl::not_null<PeerListRow*> row, bool checked) override;
|
void peerListSetRowChecked(not_null<PeerListRow*> row, bool checked) override;
|
||||||
gsl::not_null<PeerListRow*> peerListRowAt(int index) override;
|
not_null<PeerListRow*> peerListRowAt(int index) override;
|
||||||
bool peerListIsRowSelected(gsl::not_null<PeerData*> peer) override;
|
bool peerListIsRowSelected(not_null<PeerData*> peer) override;
|
||||||
int peerListSelectedRowsCount() override;
|
int peerListSelectedRowsCount() override;
|
||||||
std::vector<gsl::not_null<PeerData*>> peerListCollectSelectedRows() override;
|
std::vector<not_null<PeerData*>> peerListCollectSelectedRows() override;
|
||||||
void peerListRefreshRows() override;
|
void peerListRefreshRows() override;
|
||||||
void peerListScrollToTop() override;
|
void peerListScrollToTop() override;
|
||||||
int peerListFullRowsCount() override;
|
int peerListFullRowsCount() override;
|
||||||
|
@ -367,12 +367,12 @@ protected:
|
||||||
void paintEvent(QPaintEvent *e) override;
|
void paintEvent(QPaintEvent *e) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void peerListAddSelectedRowInBunch(gsl::not_null<PeerData*> peer) override {
|
void peerListAddSelectedRowInBunch(not_null<PeerData*> peer) override {
|
||||||
addSelectItem(peer, PeerListRow::SetStyle::Fast);
|
addSelectItem(peer, PeerListRow::SetStyle::Fast);
|
||||||
}
|
}
|
||||||
void peerListFinishSelectedRowsBunch() override;
|
void peerListFinishSelectedRowsBunch() override;
|
||||||
|
|
||||||
void addSelectItem(gsl::not_null<PeerData*> peer, PeerListRow::SetStyle style);
|
void addSelectItem(not_null<PeerData*> peer, PeerListRow::SetStyle style);
|
||||||
void createMultiSelect();
|
void createMultiSelect();
|
||||||
int getTopScrollSkip() const;
|
int getTopScrollSkip() const;
|
||||||
void updateScrollSkips();
|
void updateScrollSkips();
|
||||||
|
@ -394,7 +394,7 @@ class PeerListBox::Inner : public TWidget, private base::Subscriber {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Inner(QWidget *parent, gsl::not_null<PeerListController*> controller);
|
Inner(QWidget *parent, not_null<PeerListController*> controller);
|
||||||
|
|
||||||
void selectSkip(int direction);
|
void selectSkip(int direction);
|
||||||
void selectSkipPage(int height, int direction);
|
void selectSkipPage(int height, int direction);
|
||||||
|
@ -409,17 +409,17 @@ public:
|
||||||
// Interface for the controller.
|
// Interface for the controller.
|
||||||
void appendRow(std::unique_ptr<PeerListRow> row);
|
void appendRow(std::unique_ptr<PeerListRow> row);
|
||||||
void appendSearchRow(std::unique_ptr<PeerListRow> row);
|
void appendSearchRow(std::unique_ptr<PeerListRow> row);
|
||||||
void appendFoundRow(gsl::not_null<PeerListRow*> row);
|
void appendFoundRow(not_null<PeerListRow*> row);
|
||||||
void prependRow(std::unique_ptr<PeerListRow> row);
|
void prependRow(std::unique_ptr<PeerListRow> row);
|
||||||
void prependRowFromSearchResult(gsl::not_null<PeerListRow*> row);
|
void prependRowFromSearchResult(not_null<PeerListRow*> row);
|
||||||
PeerListRow *findRow(PeerListRowId id);
|
PeerListRow *findRow(PeerListRowId id);
|
||||||
void updateRow(gsl::not_null<PeerListRow*> row) {
|
void updateRow(not_null<PeerListRow*> row) {
|
||||||
updateRow(row, RowIndex());
|
updateRow(row, RowIndex());
|
||||||
}
|
}
|
||||||
void removeRow(gsl::not_null<PeerListRow*> row);
|
void removeRow(not_null<PeerListRow*> row);
|
||||||
void convertRowToSearchResult(gsl::not_null<PeerListRow*> row);
|
void convertRowToSearchResult(not_null<PeerListRow*> row);
|
||||||
int fullRowsCount() const;
|
int fullRowsCount() const;
|
||||||
gsl::not_null<PeerListRow*> rowAt(int index) const;
|
not_null<PeerListRow*> rowAt(int index) const;
|
||||||
void setDescription(object_ptr<Ui::FlatLabel> description);
|
void setDescription(object_ptr<Ui::FlatLabel> description);
|
||||||
void setSearchLoading(object_ptr<Ui::FlatLabel> loading);
|
void setSearchLoading(object_ptr<Ui::FlatLabel> loading);
|
||||||
void setSearchNoResults(object_ptr<Ui::FlatLabel> noResults);
|
void setSearchNoResults(object_ptr<Ui::FlatLabel> noResults);
|
||||||
|
@ -427,7 +427,7 @@ public:
|
||||||
void refreshRows();
|
void refreshRows();
|
||||||
|
|
||||||
void setSearchMode(PeerListSearchMode mode);
|
void setSearchMode(PeerListSearchMode mode);
|
||||||
void changeCheckState(gsl::not_null<PeerListRow*> row, bool checked, PeerListRow::SetStyle style);
|
void changeCheckState(not_null<PeerListRow*> row, bool checked, PeerListRow::SetStyle style);
|
||||||
|
|
||||||
template <typename ReorderCallback>
|
template <typename ReorderCallback>
|
||||||
void reorderRows(ReorderCallback &&callback) {
|
void reorderRows(ReorderCallback &&callback) {
|
||||||
|
@ -499,19 +499,19 @@ private:
|
||||||
void loadProfilePhotos();
|
void loadProfilePhotos();
|
||||||
void checkScrollForPreload();
|
void checkScrollForPreload();
|
||||||
|
|
||||||
void updateRow(gsl::not_null<PeerListRow*> row, RowIndex hint);
|
void updateRow(not_null<PeerListRow*> row, RowIndex hint);
|
||||||
void updateRow(RowIndex row);
|
void updateRow(RowIndex row);
|
||||||
int getRowTop(RowIndex row) const;
|
int getRowTop(RowIndex row) const;
|
||||||
PeerListRow *getRow(RowIndex element);
|
PeerListRow *getRow(RowIndex element);
|
||||||
RowIndex findRowIndex(gsl::not_null<PeerListRow*> row, RowIndex hint = RowIndex());
|
RowIndex findRowIndex(not_null<PeerListRow*> row, RowIndex hint = RowIndex());
|
||||||
QRect getActionRect(gsl::not_null<PeerListRow*> row, RowIndex index) const;
|
QRect getActionRect(not_null<PeerListRow*> row, RowIndex index) const;
|
||||||
|
|
||||||
void paintRow(Painter &p, TimeMs ms, RowIndex index);
|
void paintRow(Painter &p, TimeMs ms, RowIndex index);
|
||||||
|
|
||||||
void addRowEntry(gsl::not_null<PeerListRow*> row);
|
void addRowEntry(not_null<PeerListRow*> row);
|
||||||
void addToSearchIndex(gsl::not_null<PeerListRow*> row);
|
void addToSearchIndex(not_null<PeerListRow*> row);
|
||||||
bool addingToSearchIndex() const;
|
bool addingToSearchIndex() const;
|
||||||
void removeFromSearchIndex(gsl::not_null<PeerListRow*> row);
|
void removeFromSearchIndex(not_null<PeerListRow*> row);
|
||||||
void setSearchQuery(const QString &query, const QString &normalizedQuery);
|
void setSearchQuery(const QString &query, const QString &normalizedQuery);
|
||||||
bool showingSearch() const {
|
bool showingSearch() const {
|
||||||
return !_searchQuery.isEmpty();
|
return !_searchQuery.isEmpty();
|
||||||
|
@ -529,7 +529,7 @@ private:
|
||||||
|
|
||||||
void clearSearchRows();
|
void clearSearchRows();
|
||||||
|
|
||||||
gsl::not_null<PeerListController*> _controller;
|
not_null<PeerListController*> _controller;
|
||||||
PeerListSearchMode _searchMode = PeerListSearchMode::Disabled;
|
PeerListSearchMode _searchMode = PeerListSearchMode::Disabled;
|
||||||
|
|
||||||
int _rowHeight = 0;
|
int _rowHeight = 0;
|
||||||
|
@ -541,14 +541,14 @@ private:
|
||||||
bool _mouseSelection = false;
|
bool _mouseSelection = false;
|
||||||
|
|
||||||
std::vector<std::unique_ptr<PeerListRow>> _rows;
|
std::vector<std::unique_ptr<PeerListRow>> _rows;
|
||||||
std::map<PeerListRowId, gsl::not_null<PeerListRow*>> _rowsById;
|
std::map<PeerListRowId, not_null<PeerListRow*>> _rowsById;
|
||||||
std::map<PeerData*, std::vector<gsl::not_null<PeerListRow*>>> _rowsByPeer;
|
std::map<PeerData*, std::vector<not_null<PeerListRow*>>> _rowsByPeer;
|
||||||
|
|
||||||
std::map<QChar, std::vector<gsl::not_null<PeerListRow*>>> _searchIndex;
|
std::map<QChar, std::vector<not_null<PeerListRow*>>> _searchIndex;
|
||||||
QString _searchQuery;
|
QString _searchQuery;
|
||||||
QString _normalizedSearchQuery;
|
QString _normalizedSearchQuery;
|
||||||
QString _mentionHighlight;
|
QString _mentionHighlight;
|
||||||
std::vector<gsl::not_null<PeerListRow*>> _filterResults;
|
std::vector<not_null<PeerListRow*>> _filterResults;
|
||||||
|
|
||||||
int _aboveHeight = 0;
|
int _aboveHeight = 0;
|
||||||
object_ptr<TWidget> _aboveWidget = { nullptr };
|
object_ptr<TWidget> _aboveWidget = { nullptr };
|
||||||
|
|
|
@ -33,7 +33,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
base::flat_set<gsl::not_null<UserData*>> GetAlreadyInFromPeer(PeerData *peer) {
|
base::flat_set<not_null<UserData*>> GetAlreadyInFromPeer(PeerData *peer) {
|
||||||
if (!peer) {
|
if (!peer) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -266,11 +266,11 @@ QString ChatsListBoxController::emptyBoxText() const {
|
||||||
return lang(lng_contacts_not_found);
|
return lang(lng_contacts_not_found);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<PeerListRow> ChatsListBoxController::createSearchRow(gsl::not_null<PeerData*> peer) {
|
std::unique_ptr<PeerListRow> ChatsListBoxController::createSearchRow(not_null<PeerData*> peer) {
|
||||||
return createRow(App::history(peer));
|
return createRow(App::history(peer));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChatsListBoxController::appendRow(gsl::not_null<History*> history) {
|
bool ChatsListBoxController::appendRow(not_null<History*> history) {
|
||||||
if (auto row = delegate()->peerListFindRow(history->peer->id)) {
|
if (auto row = delegate()->peerListFindRow(history->peer->id)) {
|
||||||
updateRowHook(static_cast<Row*>(row));
|
updateRowHook(static_cast<Row*>(row));
|
||||||
return false;
|
return false;
|
||||||
|
@ -328,15 +328,15 @@ void ContactsBoxController::checkForEmptyRows() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<PeerListRow> ContactsBoxController::createSearchRow(gsl::not_null<PeerData*> peer) {
|
std::unique_ptr<PeerListRow> ContactsBoxController::createSearchRow(not_null<PeerData*> peer) {
|
||||||
return createRow(peer->asUser());
|
return createRow(peer->asUser());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContactsBoxController::rowClicked(gsl::not_null<PeerListRow*> row) {
|
void ContactsBoxController::rowClicked(not_null<PeerListRow*> row) {
|
||||||
Ui::showPeerHistory(row->peer(), ShowAtUnreadMsgId);
|
Ui::showPeerHistory(row->peer(), ShowAtUnreadMsgId);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ContactsBoxController::appendRow(gsl::not_null<UserData*> user) {
|
bool ContactsBoxController::appendRow(not_null<UserData*> user) {
|
||||||
if (auto row = delegate()->peerListFindRow(user->id)) {
|
if (auto row = delegate()->peerListFindRow(user->id)) {
|
||||||
updateRowHook(row);
|
updateRowHook(row);
|
||||||
return false;
|
return false;
|
||||||
|
@ -348,7 +348,7 @@ bool ContactsBoxController::appendRow(gsl::not_null<UserData*> user) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<PeerListRow> ContactsBoxController::createRow(gsl::not_null<UserData*> user) {
|
std::unique_ptr<PeerListRow> ContactsBoxController::createRow(not_null<UserData*> user) {
|
||||||
return std::make_unique<PeerListRow>(user);
|
return std::make_unique<PeerListRow>(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,14 +359,14 @@ AddParticipantsBoxController::AddParticipantsBoxController(PeerData *peer)
|
||||||
}
|
}
|
||||||
|
|
||||||
AddParticipantsBoxController::AddParticipantsBoxController(
|
AddParticipantsBoxController::AddParticipantsBoxController(
|
||||||
gsl::not_null<ChannelData*> channel,
|
not_null<ChannelData*> channel,
|
||||||
base::flat_set<gsl::not_null<UserData*>> &&alreadyIn)
|
base::flat_set<not_null<UserData*>> &&alreadyIn)
|
||||||
: ContactsBoxController(std::make_unique<PeerListGlobalSearchController>())
|
: ContactsBoxController(std::make_unique<PeerListGlobalSearchController>())
|
||||||
, _peer(channel)
|
, _peer(channel)
|
||||||
, _alreadyIn(std::move(alreadyIn)) {
|
, _alreadyIn(std::move(alreadyIn)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddParticipantsBoxController::rowClicked(gsl::not_null<PeerListRow*> row) {
|
void AddParticipantsBoxController::rowClicked(not_null<PeerListRow*> row) {
|
||||||
auto count = fullCount();
|
auto count = fullCount();
|
||||||
auto limit = (_peer && _peer->isMegagroup()) ? Global::MegagroupSizeMax() : Global::ChatSizeMax();
|
auto limit = (_peer && _peer->isMegagroup()) ? Global::MegagroupSizeMax() : Global::ChatSizeMax();
|
||||||
if (count < limit || row->checked()) {
|
if (count < limit || row->checked()) {
|
||||||
|
@ -381,7 +381,7 @@ void AddParticipantsBoxController::rowClicked(gsl::not_null<PeerListRow*> row) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddParticipantsBoxController::itemDeselectedHook(gsl::not_null<PeerData*> peer) {
|
void AddParticipantsBoxController::itemDeselectedHook(not_null<PeerData*> peer) {
|
||||||
updateTitle();
|
updateTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,7 +401,7 @@ int AddParticipantsBoxController::alreadyInCount() const {
|
||||||
Unexpected("User in AddParticipantsBoxController::alreadyInCount");
|
Unexpected("User in AddParticipantsBoxController::alreadyInCount");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AddParticipantsBoxController::isAlreadyIn(gsl::not_null<UserData*> user) const {
|
bool AddParticipantsBoxController::isAlreadyIn(not_null<UserData*> user) const {
|
||||||
if (!_peer) {
|
if (!_peer) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -418,7 +418,7 @@ int AddParticipantsBoxController::fullCount() const {
|
||||||
return alreadyInCount() + delegate()->peerListSelectedRowsCount();
|
return alreadyInCount() + delegate()->peerListSelectedRowsCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<PeerListRow> AddParticipantsBoxController::createRow(gsl::not_null<UserData*> user) {
|
std::unique_ptr<PeerListRow> AddParticipantsBoxController::createRow(not_null<UserData*> user) {
|
||||||
if (user->isSelf()) {
|
if (user->isSelf()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -437,12 +437,12 @@ void AddParticipantsBoxController::updateTitle() {
|
||||||
delegate()->peerListSetAdditionalTitle([additional] { return additional; });
|
delegate()->peerListSetAdditionalTitle([additional] { return additional; });
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddParticipantsBoxController::Start(gsl::not_null<ChatData*> chat) {
|
void AddParticipantsBoxController::Start(not_null<ChatData*> chat) {
|
||||||
auto initBox = [chat](gsl::not_null<PeerListBox*> box) {
|
auto initBox = [chat](not_null<PeerListBox*> box) {
|
||||||
box->addButton(langFactory(lng_participant_invite), [box, chat] {
|
box->addButton(langFactory(lng_participant_invite), [box, chat] {
|
||||||
auto rows = box->peerListCollectSelectedRows();
|
auto rows = box->peerListCollectSelectedRows();
|
||||||
if (!rows.empty()) {
|
if (!rows.empty()) {
|
||||||
auto users = std::vector<gsl::not_null<UserData*>>();
|
auto users = std::vector<not_null<UserData*>>();
|
||||||
for (auto peer : rows) {
|
for (auto peer : rows) {
|
||||||
auto user = peer->asUser();
|
auto user = peer->asUser();
|
||||||
t_assert(user != nullptr);
|
t_assert(user != nullptr);
|
||||||
|
@ -459,15 +459,15 @@ void AddParticipantsBoxController::Start(gsl::not_null<ChatData*> chat) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddParticipantsBoxController::Start(
|
void AddParticipantsBoxController::Start(
|
||||||
gsl::not_null<ChannelData*> channel,
|
not_null<ChannelData*> channel,
|
||||||
base::flat_set<gsl::not_null<UserData*>> &&alreadyIn,
|
base::flat_set<not_null<UserData*>> &&alreadyIn,
|
||||||
bool justCreated) {
|
bool justCreated) {
|
||||||
auto initBox = [channel, justCreated](gsl::not_null<PeerListBox*> box) {
|
auto initBox = [channel, justCreated](not_null<PeerListBox*> box) {
|
||||||
auto subscription = std::make_shared<base::Subscription>();
|
auto subscription = std::make_shared<base::Subscription>();
|
||||||
box->addButton(langFactory(lng_participant_invite), [box, channel, subscription] {
|
box->addButton(langFactory(lng_participant_invite), [box, channel, subscription] {
|
||||||
auto rows = box->peerListCollectSelectedRows();
|
auto rows = box->peerListCollectSelectedRows();
|
||||||
if (!rows.empty()) {
|
if (!rows.empty()) {
|
||||||
auto users = std::vector<gsl::not_null<UserData*>>();
|
auto users = std::vector<not_null<UserData*>>();
|
||||||
for (auto peer : rows) {
|
for (auto peer : rows) {
|
||||||
auto user = peer->asUser();
|
auto user = peer->asUser();
|
||||||
t_assert(user != nullptr);
|
t_assert(user != nullptr);
|
||||||
|
@ -493,12 +493,12 @@ void AddParticipantsBoxController::Start(
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddParticipantsBoxController::Start(
|
void AddParticipantsBoxController::Start(
|
||||||
gsl::not_null<ChannelData*> channel,
|
not_null<ChannelData*> channel,
|
||||||
base::flat_set<gsl::not_null<UserData*>> &&alreadyIn) {
|
base::flat_set<not_null<UserData*>> &&alreadyIn) {
|
||||||
Start(channel, std::move(alreadyIn), false);
|
Start(channel, std::move(alreadyIn), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddParticipantsBoxController::Start(gsl::not_null<ChannelData*> channel) {
|
void AddParticipantsBoxController::Start(not_null<ChannelData*> channel) {
|
||||||
Start(channel, {}, true);
|
Start(channel, {}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -548,7 +548,7 @@ void EditChatAdminsBoxController::LabeledCheckbox::paintEvent(QPaintEvent *e) {
|
||||||
(checked() ? _labelChecked : _labelUnchecked).draw(p, st::contactsPadding.left(), st::contactsAboutTop, _labelWidth);
|
(checked() ? _labelChecked : _labelUnchecked).draw(p, st::contactsPadding.left(), st::contactsAboutTop, _labelWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
EditChatAdminsBoxController::EditChatAdminsBoxController(gsl::not_null<ChatData*> chat)
|
EditChatAdminsBoxController::EditChatAdminsBoxController(not_null<ChatData*> chat)
|
||||||
: PeerListController()
|
: PeerListController()
|
||||||
, _chat(chat) {
|
, _chat(chat) {
|
||||||
}
|
}
|
||||||
|
@ -609,7 +609,7 @@ void EditChatAdminsBoxController::rebuildRows() {
|
||||||
|
|
||||||
auto allAdmins = allAreAdmins();
|
auto allAdmins = allAreAdmins();
|
||||||
|
|
||||||
auto admins = std::vector<gsl::not_null<UserData*>>();
|
auto admins = std::vector<not_null<UserData*>>();
|
||||||
auto others = admins;
|
auto others = admins;
|
||||||
admins.reserve(allAdmins ? _chat->participants.size() : _chat->admins.size());
|
admins.reserve(allAdmins ? _chat->participants.size() : _chat->admins.size());
|
||||||
others.reserve(_chat->participants.size());
|
others.reserve(_chat->participants.size());
|
||||||
|
@ -636,7 +636,7 @@ void EditChatAdminsBoxController::rebuildRows() {
|
||||||
std::sort(admins.begin(), admins.end(), sortByName);
|
std::sort(admins.begin(), admins.end(), sortByName);
|
||||||
std::sort(others.begin(), others.end(), sortByName);
|
std::sort(others.begin(), others.end(), sortByName);
|
||||||
|
|
||||||
auto addOne = [this](gsl::not_null<UserData*> user) {
|
auto addOne = [this](not_null<UserData*> user) {
|
||||||
if (auto row = createRow(user)) {
|
if (auto row = createRow(user)) {
|
||||||
delegate()->peerListAppendRow(std::move(row));
|
delegate()->peerListAppendRow(std::move(row));
|
||||||
}
|
}
|
||||||
|
@ -652,7 +652,7 @@ void EditChatAdminsBoxController::rebuildRows() {
|
||||||
delegate()->peerListRefreshRows();
|
delegate()->peerListRefreshRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<PeerListRow> EditChatAdminsBoxController::createRow(gsl::not_null<UserData*> user) {
|
std::unique_ptr<PeerListRow> EditChatAdminsBoxController::createRow(not_null<UserData*> user) {
|
||||||
auto result = std::make_unique<PeerListRow>(user);
|
auto result = std::make_unique<PeerListRow>(user);
|
||||||
if (allAreAdmins() || user->id == peerFromUser(_chat->creator)) {
|
if (allAreAdmins() || user->id == peerFromUser(_chat->creator)) {
|
||||||
result->setDisabledState(PeerListRow::State::DisabledChecked);
|
result->setDisabledState(PeerListRow::State::DisabledChecked);
|
||||||
|
@ -660,17 +660,17 @@ std::unique_ptr<PeerListRow> EditChatAdminsBoxController::createRow(gsl::not_nul
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditChatAdminsBoxController::rowClicked(gsl::not_null<PeerListRow*> row) {
|
void EditChatAdminsBoxController::rowClicked(not_null<PeerListRow*> row) {
|
||||||
delegate()->peerListSetRowChecked(row, !row->checked());
|
delegate()->peerListSetRowChecked(row, !row->checked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditChatAdminsBoxController::Start(gsl::not_null<ChatData*> chat) {
|
void EditChatAdminsBoxController::Start(not_null<ChatData*> chat) {
|
||||||
auto controller = std::make_unique<EditChatAdminsBoxController>(chat);
|
auto controller = std::make_unique<EditChatAdminsBoxController>(chat);
|
||||||
auto initBox = [chat, controller = controller.get()](gsl::not_null<PeerListBox*> box) {
|
auto initBox = [chat, controller = controller.get()](not_null<PeerListBox*> box) {
|
||||||
box->addButton(langFactory(lng_settings_save), [box, chat, controller] {
|
box->addButton(langFactory(lng_settings_save), [box, chat, controller] {
|
||||||
auto rows = box->peerListCollectSelectedRows();
|
auto rows = box->peerListCollectSelectedRows();
|
||||||
if (!rows.empty()) {
|
if (!rows.empty()) {
|
||||||
auto users = std::vector<gsl::not_null<UserData*>>();
|
auto users = std::vector<not_null<UserData*>>();
|
||||||
for (auto peer : rows) {
|
for (auto peer : rows) {
|
||||||
auto user = peer->asUser();
|
auto user = peer->asUser();
|
||||||
t_assert(user != nullptr);
|
t_assert(user != nullptr);
|
||||||
|
@ -686,21 +686,21 @@ void EditChatAdminsBoxController::Start(gsl::not_null<ChatData*> chat) {
|
||||||
Ui::show(Box<PeerListBox>(std::move(controller), std::move(initBox)));
|
Ui::show(Box<PeerListBox>(std::move(controller), std::move(initBox)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddBotToGroupBoxController::Start(gsl::not_null<UserData*> bot) {
|
void AddBotToGroupBoxController::Start(not_null<UserData*> bot) {
|
||||||
auto initBox = [bot](gsl::not_null<PeerListBox*> box) {
|
auto initBox = [bot](not_null<PeerListBox*> box) {
|
||||||
box->addButton(langFactory(lng_cancel), [box] { box->closeBox(); });
|
box->addButton(langFactory(lng_cancel), [box] { box->closeBox(); });
|
||||||
};
|
};
|
||||||
Ui::show(Box<PeerListBox>(std::make_unique<AddBotToGroupBoxController>(bot), std::move(initBox)));
|
Ui::show(Box<PeerListBox>(std::make_unique<AddBotToGroupBoxController>(bot), std::move(initBox)));
|
||||||
}
|
}
|
||||||
|
|
||||||
AddBotToGroupBoxController::AddBotToGroupBoxController(gsl::not_null<UserData*> bot)
|
AddBotToGroupBoxController::AddBotToGroupBoxController(not_null<UserData*> bot)
|
||||||
: ChatsListBoxController(SharingBotGame(bot)
|
: ChatsListBoxController(SharingBotGame(bot)
|
||||||
? std::make_unique<PeerListGlobalSearchController>()
|
? std::make_unique<PeerListGlobalSearchController>()
|
||||||
: nullptr)
|
: nullptr)
|
||||||
, _bot(bot) {
|
, _bot(bot) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddBotToGroupBoxController::rowClicked(gsl::not_null<PeerListRow*> row) {
|
void AddBotToGroupBoxController::rowClicked(not_null<PeerListRow*> row) {
|
||||||
if (sharingBotGame()) {
|
if (sharingBotGame()) {
|
||||||
shareBotGame(row->peer());
|
shareBotGame(row->peer());
|
||||||
} else {
|
} else {
|
||||||
|
@ -708,7 +708,7 @@ void AddBotToGroupBoxController::rowClicked(gsl::not_null<PeerListRow*> row) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddBotToGroupBoxController::shareBotGame(gsl::not_null<PeerData*> chat) {
|
void AddBotToGroupBoxController::shareBotGame(not_null<PeerData*> chat) {
|
||||||
auto weak = base::make_weak_unique(this);
|
auto weak = base::make_weak_unique(this);
|
||||||
auto send = [weak, bot = _bot, chat] {
|
auto send = [weak, bot = _bot, chat] {
|
||||||
if (!weak) {
|
if (!weak) {
|
||||||
|
@ -746,7 +746,7 @@ void AddBotToGroupBoxController::shareBotGame(gsl::not_null<PeerData*> chat) {
|
||||||
Ui::show(Box<ConfirmBox>(confirmText(), send), KeepOtherLayers);
|
Ui::show(Box<ConfirmBox>(confirmText(), send), KeepOtherLayers);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddBotToGroupBoxController::addBotToGroup(gsl::not_null<PeerData*> chat) {
|
void AddBotToGroupBoxController::addBotToGroup(not_null<PeerData*> chat) {
|
||||||
if (auto megagroup = chat->asMegagroup()) {
|
if (auto megagroup = chat->asMegagroup()) {
|
||||||
if (!megagroup->canAddMembers()) {
|
if (!megagroup->canAddMembers()) {
|
||||||
Ui::show(Box<InformBox>(lang(lng_error_cant_add_member)), KeepOtherLayers);
|
Ui::show(Box<InformBox>(lang(lng_error_cant_add_member)), KeepOtherLayers);
|
||||||
|
@ -788,14 +788,14 @@ void AddBotToGroupBoxController::addBotToGroup(gsl::not_null<PeerData*> chat) {
|
||||||
Ui::show(Box<ConfirmBox>(confirmText, send), KeepOtherLayers);
|
Ui::show(Box<ConfirmBox>(confirmText, send), KeepOtherLayers);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<ChatsListBoxController::Row> AddBotToGroupBoxController::createRow(gsl::not_null<History*> history) {
|
std::unique_ptr<ChatsListBoxController::Row> AddBotToGroupBoxController::createRow(not_null<History*> history) {
|
||||||
if (!needToCreateRow(history->peer)) {
|
if (!needToCreateRow(history->peer)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
return std::make_unique<Row>(history);
|
return std::make_unique<Row>(history);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AddBotToGroupBoxController::needToCreateRow(gsl::not_null<PeerData*> peer) const {
|
bool AddBotToGroupBoxController::needToCreateRow(not_null<PeerData*> peer) const {
|
||||||
if (sharingBotGame()) {
|
if (sharingBotGame()) {
|
||||||
if (!peer->canWrite()) {
|
if (!peer->canWrite()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -817,7 +817,7 @@ bool AddBotToGroupBoxController::needToCreateRow(gsl::not_null<PeerData*> peer)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AddBotToGroupBoxController::SharingBotGame(gsl::not_null<UserData*> bot) {
|
bool AddBotToGroupBoxController::SharingBotGame(not_null<UserData*> bot) {
|
||||||
auto &info = bot->botInfo;
|
auto &info = bot->botInfo;
|
||||||
return (info && !info->shareGameShortName.isEmpty());
|
return (info && !info->shareGameShortName.isEmpty());
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,31 +88,31 @@ public:
|
||||||
ChatsListBoxController(std::unique_ptr<PeerListSearchController> searchController = std::make_unique<PeerListGlobalSearchController>());
|
ChatsListBoxController(std::unique_ptr<PeerListSearchController> searchController = std::make_unique<PeerListGlobalSearchController>());
|
||||||
|
|
||||||
void prepare() override final;
|
void prepare() override final;
|
||||||
std::unique_ptr<PeerListRow> createSearchRow(gsl::not_null<PeerData*> peer) override final;
|
std::unique_ptr<PeerListRow> createSearchRow(not_null<PeerData*> peer) override final;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
class Row : public PeerListRow {
|
class Row : public PeerListRow {
|
||||||
public:
|
public:
|
||||||
Row(gsl::not_null<History*> history) : PeerListRow(history->peer), _history(history) {
|
Row(not_null<History*> history) : PeerListRow(history->peer), _history(history) {
|
||||||
}
|
}
|
||||||
gsl::not_null<History*> history() const {
|
not_null<History*> history() const {
|
||||||
return _history;
|
return _history;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
gsl::not_null<History*> _history;
|
not_null<History*> _history;
|
||||||
|
|
||||||
};
|
};
|
||||||
virtual std::unique_ptr<Row> createRow(gsl::not_null<History*> history) = 0;
|
virtual std::unique_ptr<Row> createRow(not_null<History*> history) = 0;
|
||||||
virtual void prepareViewHook() = 0;
|
virtual void prepareViewHook() = 0;
|
||||||
virtual void updateRowHook(gsl::not_null<Row*> row) {
|
virtual void updateRowHook(not_null<Row*> row) {
|
||||||
}
|
}
|
||||||
virtual QString emptyBoxText() const;
|
virtual QString emptyBoxText() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void rebuildRows();
|
void rebuildRows();
|
||||||
void checkForEmptyRows();
|
void checkForEmptyRows();
|
||||||
bool appendRow(gsl::not_null<History*> history);
|
bool appendRow(not_null<History*> history);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -121,40 +121,40 @@ public:
|
||||||
ContactsBoxController(std::unique_ptr<PeerListSearchController> searchController = std::make_unique<PeerListGlobalSearchController>());
|
ContactsBoxController(std::unique_ptr<PeerListSearchController> searchController = std::make_unique<PeerListGlobalSearchController>());
|
||||||
|
|
||||||
void prepare() override final;
|
void prepare() override final;
|
||||||
std::unique_ptr<PeerListRow> createSearchRow(gsl::not_null<PeerData*> peer) override final;
|
std::unique_ptr<PeerListRow> createSearchRow(not_null<PeerData*> peer) override final;
|
||||||
void rowClicked(gsl::not_null<PeerListRow*> row) override;
|
void rowClicked(not_null<PeerListRow*> row) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual std::unique_ptr<PeerListRow> createRow(gsl::not_null<UserData*> user);
|
virtual std::unique_ptr<PeerListRow> createRow(not_null<UserData*> user);
|
||||||
virtual void prepareViewHook() {
|
virtual void prepareViewHook() {
|
||||||
}
|
}
|
||||||
virtual void updateRowHook(gsl::not_null<PeerListRow*> row) {
|
virtual void updateRowHook(not_null<PeerListRow*> row) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void rebuildRows();
|
void rebuildRows();
|
||||||
void checkForEmptyRows();
|
void checkForEmptyRows();
|
||||||
bool appendRow(gsl::not_null<UserData*> user);
|
bool appendRow(not_null<UserData*> user);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class EditChatAdminsBoxController : public PeerListController, private base::Subscriber {
|
class EditChatAdminsBoxController : public PeerListController, private base::Subscriber {
|
||||||
public:
|
public:
|
||||||
static void Start(gsl::not_null<ChatData*> chat);
|
static void Start(not_null<ChatData*> chat);
|
||||||
|
|
||||||
EditChatAdminsBoxController(gsl::not_null<ChatData*> chat);
|
EditChatAdminsBoxController(not_null<ChatData*> chat);
|
||||||
|
|
||||||
bool allAreAdmins() const;
|
bool allAreAdmins() const;
|
||||||
|
|
||||||
void prepare() override;
|
void prepare() override;
|
||||||
void rowClicked(gsl::not_null<PeerListRow*> row) override;
|
void rowClicked(not_null<PeerListRow*> row) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createAllAdminsCheckbox();
|
void createAllAdminsCheckbox();
|
||||||
void rebuildRows();
|
void rebuildRows();
|
||||||
std::unique_ptr<PeerListRow> createRow(gsl::not_null<UserData*> user);
|
std::unique_ptr<PeerListRow> createRow(not_null<UserData*> user);
|
||||||
|
|
||||||
gsl::not_null<ChatData*> _chat;
|
not_null<ChatData*> _chat;
|
||||||
int _adminsUpdatedSubscription = 0;
|
int _adminsUpdatedSubscription = 0;
|
||||||
|
|
||||||
class LabeledCheckbox;
|
class LabeledCheckbox;
|
||||||
|
@ -164,67 +164,67 @@ private:
|
||||||
|
|
||||||
class AddParticipantsBoxController : public ContactsBoxController {
|
class AddParticipantsBoxController : public ContactsBoxController {
|
||||||
public:
|
public:
|
||||||
static void Start(gsl::not_null<ChatData*> chat);
|
static void Start(not_null<ChatData*> chat);
|
||||||
static void Start(gsl::not_null<ChannelData*> channel);
|
static void Start(not_null<ChannelData*> channel);
|
||||||
static void Start(
|
static void Start(
|
||||||
gsl::not_null<ChannelData*> channel,
|
not_null<ChannelData*> channel,
|
||||||
base::flat_set<gsl::not_null<UserData*>> &&alreadyIn);
|
base::flat_set<not_null<UserData*>> &&alreadyIn);
|
||||||
|
|
||||||
AddParticipantsBoxController(PeerData *peer);
|
AddParticipantsBoxController(PeerData *peer);
|
||||||
AddParticipantsBoxController(
|
AddParticipantsBoxController(
|
||||||
gsl::not_null<ChannelData*> channel,
|
not_null<ChannelData*> channel,
|
||||||
base::flat_set<gsl::not_null<UserData*>> &&alreadyIn);
|
base::flat_set<not_null<UserData*>> &&alreadyIn);
|
||||||
|
|
||||||
using ContactsBoxController::ContactsBoxController;
|
using ContactsBoxController::ContactsBoxController;
|
||||||
|
|
||||||
void rowClicked(gsl::not_null<PeerListRow*> row) override;
|
void rowClicked(not_null<PeerListRow*> row) override;
|
||||||
void itemDeselectedHook(gsl::not_null<PeerData*> peer) override;
|
void itemDeselectedHook(not_null<PeerData*> peer) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void prepareViewHook() override;
|
void prepareViewHook() override;
|
||||||
std::unique_ptr<PeerListRow> createRow(gsl::not_null<UserData*> user) override;
|
std::unique_ptr<PeerListRow> createRow(not_null<UserData*> user) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void Start(
|
static void Start(
|
||||||
gsl::not_null<ChannelData*> channel,
|
not_null<ChannelData*> channel,
|
||||||
base::flat_set<gsl::not_null<UserData*>> &&alreadyIn,
|
base::flat_set<not_null<UserData*>> &&alreadyIn,
|
||||||
bool justCreated);
|
bool justCreated);
|
||||||
|
|
||||||
int alreadyInCount() const;
|
int alreadyInCount() const;
|
||||||
bool isAlreadyIn(gsl::not_null<UserData*> user) const;
|
bool isAlreadyIn(not_null<UserData*> user) const;
|
||||||
int fullCount() const;
|
int fullCount() const;
|
||||||
void updateTitle();
|
void updateTitle();
|
||||||
|
|
||||||
PeerData *_peer = nullptr;
|
PeerData *_peer = nullptr;
|
||||||
base::flat_set<gsl::not_null<UserData*>> _alreadyIn;
|
base::flat_set<not_null<UserData*>> _alreadyIn;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class AddBotToGroupBoxController : public ChatsListBoxController, public base::enable_weak_from_this {
|
class AddBotToGroupBoxController : public ChatsListBoxController, public base::enable_weak_from_this {
|
||||||
public:
|
public:
|
||||||
static void Start(gsl::not_null<UserData*> bot);
|
static void Start(not_null<UserData*> bot);
|
||||||
|
|
||||||
AddBotToGroupBoxController(gsl::not_null<UserData*> bot);
|
AddBotToGroupBoxController(not_null<UserData*> bot);
|
||||||
|
|
||||||
void rowClicked(gsl::not_null<PeerListRow*> row) override;
|
void rowClicked(not_null<PeerListRow*> row) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::unique_ptr<Row> createRow(gsl::not_null<History*> history) override;
|
std::unique_ptr<Row> createRow(not_null<History*> history) override;
|
||||||
void prepareViewHook() override;
|
void prepareViewHook() override;
|
||||||
QString emptyBoxText() const override;
|
QString emptyBoxText() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static bool SharingBotGame(gsl::not_null<UserData*> bot);
|
static bool SharingBotGame(not_null<UserData*> bot);
|
||||||
|
|
||||||
bool needToCreateRow(gsl::not_null<PeerData*> peer) const;
|
bool needToCreateRow(not_null<PeerData*> peer) const;
|
||||||
bool sharingBotGame() const;
|
bool sharingBotGame() const;
|
||||||
QString noResultsText() const;
|
QString noResultsText() const;
|
||||||
QString descriptionText() const;
|
QString descriptionText() const;
|
||||||
void updateLabels();
|
void updateLabels();
|
||||||
|
|
||||||
void shareBotGame(gsl::not_null<PeerData*> chat);
|
void shareBotGame(not_null<PeerData*> chat);
|
||||||
void addBotToGroup(gsl::not_null<PeerData*> chat);
|
void addBotToGroup(not_null<PeerData*> chat);
|
||||||
|
|
||||||
gsl::not_null<UserData*> _bot;
|
not_null<UserData*> _bot;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -156,7 +156,7 @@ StickersBox::StickersBox(QWidget*, const Stickers::Order &archivedIds)
|
||||||
, _about(st::boxLabelStyle, lang(lng_stickers_packs_archived), _defaultOptions, _aboutWidth) {
|
, _about(st::boxLabelStyle, lang(lng_stickers_packs_archived), _defaultOptions, _aboutWidth) {
|
||||||
}
|
}
|
||||||
|
|
||||||
StickersBox::StickersBox(QWidget*, gsl::not_null<ChannelData*> megagroup)
|
StickersBox::StickersBox(QWidget*, not_null<ChannelData*> megagroup)
|
||||||
: _section(Section::Installed)
|
: _section(Section::Installed)
|
||||||
, _installed(0, this, megagroup)
|
, _installed(0, this, megagroup)
|
||||||
, _megagroupSet(megagroup) {
|
, _megagroupSet(megagroup) {
|
||||||
|
@ -625,7 +625,7 @@ StickersBox::Inner::Inner(QWidget *parent, const Stickers::Order &archivedIds) :
|
||||||
setup();
|
setup();
|
||||||
}
|
}
|
||||||
|
|
||||||
StickersBox::Inner::Inner(QWidget *parent, gsl::not_null<ChannelData*> megagroup) : TWidget(parent)
|
StickersBox::Inner::Inner(QWidget *parent, not_null<ChannelData*> megagroup) : TWidget(parent)
|
||||||
, _section(StickersBox::Section::Installed)
|
, _section(StickersBox::Section::Installed)
|
||||||
, _rowHeight(st::contactsPadding.top() + st::contactsPhotoSize + st::contactsPadding.bottom())
|
, _rowHeight(st::contactsPadding.top() + st::contactsPhotoSize + st::contactsPadding.bottom())
|
||||||
, _a_shifting(animation(this, &Inner::step_shifting))
|
, _a_shifting(animation(this, &Inner::step_shifting))
|
||||||
|
|
|
@ -49,7 +49,7 @@ public:
|
||||||
};
|
};
|
||||||
StickersBox(QWidget*, Section section);
|
StickersBox(QWidget*, Section section);
|
||||||
StickersBox(QWidget*, const Stickers::Order &archivedIds);
|
StickersBox(QWidget*, const Stickers::Order &archivedIds);
|
||||||
StickersBox(QWidget*, gsl::not_null<ChannelData*> megagroup);
|
StickersBox(QWidget*, not_null<ChannelData*> megagroup);
|
||||||
|
|
||||||
void setInnerFocus() override;
|
void setInnerFocus() override;
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ public:
|
||||||
using Section = StickersBox::Section;
|
using Section = StickersBox::Section;
|
||||||
Inner(QWidget *parent, Section section);
|
Inner(QWidget *parent, Section section);
|
||||||
Inner(QWidget *parent, const Stickers::Order &archivedIds);
|
Inner(QWidget *parent, const Stickers::Order &archivedIds);
|
||||||
Inner(QWidget *parent, gsl::not_null<ChannelData*> megagroup);
|
Inner(QWidget *parent, not_null<ChannelData*> megagroup);
|
||||||
|
|
||||||
base::Observable<int> scrollToY;
|
base::Observable<int> scrollToY;
|
||||||
void setInnerFocus();
|
void setInnerFocus();
|
||||||
|
|
|
@ -243,13 +243,13 @@ void BoxController::refreshAbout() {
|
||||||
setDescriptionText(delegate()->peerListFullRowsCount() ? QString() : lang(lng_call_box_about));
|
setDescriptionText(delegate()->peerListFullRowsCount() ? QString() : lang(lng_call_box_about));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BoxController::rowClicked(gsl::not_null<PeerListRow*> row) {
|
void BoxController::rowClicked(not_null<PeerListRow*> row) {
|
||||||
auto itemsRow = static_cast<Row*>(row.get());
|
auto itemsRow = static_cast<Row*>(row.get());
|
||||||
auto itemId = itemsRow->maxItemId();
|
auto itemId = itemsRow->maxItemId();
|
||||||
Ui::showPeerHistoryAsync(row->peer()->id, itemId);
|
Ui::showPeerHistoryAsync(row->peer()->id, itemId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BoxController::rowActionClicked(gsl::not_null<PeerListRow*> row) {
|
void BoxController::rowActionClicked(not_null<PeerListRow*> row) {
|
||||||
auto user = row->peer()->asUser();
|
auto user = row->peer()->asUser();
|
||||||
t_assert(user != nullptr);
|
t_assert(user != nullptr);
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,8 @@ namespace Calls {
|
||||||
class BoxController : public PeerListController, private base::Subscriber, private MTP::Sender {
|
class BoxController : public PeerListController, private base::Subscriber, private MTP::Sender {
|
||||||
public:
|
public:
|
||||||
void prepare() override;
|
void prepare() override;
|
||||||
void rowClicked(gsl::not_null<PeerListRow*> row) override;
|
void rowClicked(not_null<PeerListRow*> row) override;
|
||||||
void rowActionClicked(gsl::not_null<PeerListRow*> row) override;
|
void rowActionClicked(not_null<PeerListRow*> row) override;
|
||||||
void loadMoreRows() override;
|
void loadMoreRows() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -77,7 +77,7 @@ uint64 ComputeFingerprint(const std::array<gsl::byte, kFingerprintDataSize> &aut
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Call::Call(gsl::not_null<Delegate*> delegate, gsl::not_null<UserData*> user, Type type)
|
Call::Call(not_null<Delegate*> delegate, not_null<UserData*> user, Type type)
|
||||||
: _delegate(delegate)
|
: _delegate(delegate)
|
||||||
, _user(user)
|
, _user(user)
|
||||||
, _type(type) {
|
, _type(type) {
|
||||||
|
|
|
@ -48,9 +48,9 @@ public:
|
||||||
class Delegate {
|
class Delegate {
|
||||||
public:
|
public:
|
||||||
virtual DhConfig getDhConfig() const = 0;
|
virtual DhConfig getDhConfig() const = 0;
|
||||||
virtual void callFinished(gsl::not_null<Call*> call) = 0;
|
virtual void callFinished(not_null<Call*> call) = 0;
|
||||||
virtual void callFailed(gsl::not_null<Call*> call) = 0;
|
virtual void callFailed(not_null<Call*> call) = 0;
|
||||||
virtual void callRedial(gsl::not_null<Call*> call) = 0;
|
virtual void callRedial(not_null<Call*> call) = 0;
|
||||||
|
|
||||||
enum class Sound {
|
enum class Sound {
|
||||||
Connecting,
|
Connecting,
|
||||||
|
@ -69,12 +69,12 @@ public:
|
||||||
Incoming,
|
Incoming,
|
||||||
Outgoing,
|
Outgoing,
|
||||||
};
|
};
|
||||||
Call(gsl::not_null<Delegate*> delegate, gsl::not_null<UserData*> user, Type type);
|
Call(not_null<Delegate*> delegate, not_null<UserData*> user, Type type);
|
||||||
|
|
||||||
Type type() const {
|
Type type() const {
|
||||||
return _type;
|
return _type;
|
||||||
}
|
}
|
||||||
gsl::not_null<UserData*> user() const {
|
not_null<UserData*> user() const {
|
||||||
return _user;
|
return _user;
|
||||||
}
|
}
|
||||||
bool isIncomingWaiting() const;
|
bool isIncomingWaiting() const;
|
||||||
|
@ -157,8 +157,8 @@ private:
|
||||||
void setFailedQueued(int error);
|
void setFailedQueued(int error);
|
||||||
void destroyController();
|
void destroyController();
|
||||||
|
|
||||||
gsl::not_null<Delegate*> _delegate;
|
not_null<Delegate*> _delegate;
|
||||||
gsl::not_null<UserData*> _user;
|
not_null<UserData*> _user;
|
||||||
Type _type = Type::Outgoing;
|
Type _type = Type::Outgoing;
|
||||||
State _state = State::Starting;
|
State _state = State::Starting;
|
||||||
FinishType _finishAfterRequestingCall = FinishType::None;
|
FinishType _finishAfterRequestingCall = FinishType::None;
|
||||||
|
|
|
@ -126,7 +126,7 @@ uint64 ComputeEmojiIndex(base::const_byte_span bytes) {
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
std::vector<EmojiPtr> ComputeEmojiFingerprint(gsl::not_null<Call*> call) {
|
std::vector<EmojiPtr> ComputeEmojiFingerprint(not_null<Call*> call) {
|
||||||
auto result = std::vector<EmojiPtr>();
|
auto result = std::vector<EmojiPtr>();
|
||||||
constexpr auto EmojiCount = (base::array_size(Offsets) - 1);
|
constexpr auto EmojiCount = (base::array_size(Offsets) - 1);
|
||||||
for (auto index = 0; index != EmojiCount; ++index) {
|
for (auto index = 0; index != EmojiCount; ++index) {
|
||||||
|
|
|
@ -24,6 +24,6 @@ namespace Calls {
|
||||||
|
|
||||||
class Call;
|
class Call;
|
||||||
|
|
||||||
std::vector<EmojiPtr> ComputeEmojiFingerprint(gsl::not_null<Call*> call);
|
std::vector<EmojiPtr> ComputeEmojiFingerprint(not_null<Call*> call);
|
||||||
|
|
||||||
} // namespace Calls
|
} // namespace Calls
|
||||||
|
|
|
@ -40,7 +40,7 @@ constexpr auto kServerConfigUpdateTimeoutMs = 24 * 3600 * TimeMs(1000);
|
||||||
|
|
||||||
Instance::Instance() = default;
|
Instance::Instance() = default;
|
||||||
|
|
||||||
void Instance::startOutgoingCall(gsl::not_null<UserData*> user) {
|
void Instance::startOutgoingCall(not_null<UserData*> user) {
|
||||||
if (alreadyInCall()) { // Already in a call.
|
if (alreadyInCall()) { // Already in a call.
|
||||||
_currentCallPanel->showAndActivate();
|
_currentCallPanel->showAndActivate();
|
||||||
return;
|
return;
|
||||||
|
@ -54,15 +54,15 @@ void Instance::startOutgoingCall(gsl::not_null<UserData*> user) {
|
||||||
createCall(user, Call::Type::Outgoing);
|
createCall(user, Call::Type::Outgoing);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Instance::callFinished(gsl::not_null<Call*> call) {
|
void Instance::callFinished(not_null<Call*> call) {
|
||||||
destroyCall(call);
|
destroyCall(call);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Instance::callFailed(gsl::not_null<Call*> call) {
|
void Instance::callFailed(not_null<Call*> call) {
|
||||||
destroyCall(call);
|
destroyCall(call);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Instance::callRedial(gsl::not_null<Call*> call) {
|
void Instance::callRedial(not_null<Call*> call) {
|
||||||
if (_currentCall.get() == call) {
|
if (_currentCall.get() == call) {
|
||||||
refreshDhConfig();
|
refreshDhConfig();
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ void Instance::playSound(Sound sound) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Instance::destroyCall(gsl::not_null<Call*> call) {
|
void Instance::destroyCall(not_null<Call*> call) {
|
||||||
if (_currentCall.get() == call) {
|
if (_currentCall.get() == call) {
|
||||||
destroyCurrentPanel();
|
destroyCurrentPanel();
|
||||||
_currentCall.reset();
|
_currentCall.reset();
|
||||||
|
@ -117,7 +117,7 @@ void Instance::destroyCurrentPanel() {
|
||||||
_pendingPanels.back()->hideAndDestroy(); // Always queues the destruction.
|
_pendingPanels.back()->hideAndDestroy(); // Always queues the destruction.
|
||||||
}
|
}
|
||||||
|
|
||||||
void Instance::createCall(gsl::not_null<UserData*> user, Call::Type type) {
|
void Instance::createCall(not_null<UserData*> user, Call::Type type) {
|
||||||
auto call = std::make_unique<Call>(getCallDelegate(), user, type);;
|
auto call = std::make_unique<Call>(getCallDelegate(), user, type);;
|
||||||
if (_currentCall) {
|
if (_currentCall) {
|
||||||
_currentCallPanel->replaceCall(call.get());
|
_currentCallPanel->replaceCall(call.get());
|
||||||
|
@ -246,7 +246,7 @@ void Instance::handleUpdate(const MTPDupdatePhoneCall& update) {
|
||||||
handleCallUpdate(update.vphone_call);
|
handleCallUpdate(update.vphone_call);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Instance::showInfoPanel(gsl::not_null<Call*> call) {
|
void Instance::showInfoPanel(not_null<Call*> call) {
|
||||||
if (_currentCall.get() == call) {
|
if (_currentCall.get() == call) {
|
||||||
_currentCallPanel->showAndActivate();
|
_currentCallPanel->showAndActivate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,9 +37,9 @@ class Instance : private MTP::Sender, private Call::Delegate, private base::Subs
|
||||||
public:
|
public:
|
||||||
Instance();
|
Instance();
|
||||||
|
|
||||||
void startOutgoingCall(gsl::not_null<UserData*> user);
|
void startOutgoingCall(not_null<UserData*> user);
|
||||||
void handleUpdate(const MTPDupdatePhoneCall &update);
|
void handleUpdate(const MTPDupdatePhoneCall &update);
|
||||||
void showInfoPanel(gsl::not_null<Call*> call);
|
void showInfoPanel(not_null<Call*> call);
|
||||||
|
|
||||||
base::Observable<Call*> ¤tCallChanged() {
|
base::Observable<Call*> ¤tCallChanged() {
|
||||||
return _currentCallChanged;
|
return _currentCallChanged;
|
||||||
|
@ -54,19 +54,19 @@ public:
|
||||||
~Instance();
|
~Instance();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
gsl::not_null<Call::Delegate*> getCallDelegate() {
|
not_null<Call::Delegate*> getCallDelegate() {
|
||||||
return static_cast<Call::Delegate*>(this);
|
return static_cast<Call::Delegate*>(this);
|
||||||
}
|
}
|
||||||
DhConfig getDhConfig() const override {
|
DhConfig getDhConfig() const override {
|
||||||
return _dhConfig;
|
return _dhConfig;
|
||||||
}
|
}
|
||||||
void callFinished(gsl::not_null<Call*> call) override;
|
void callFinished(not_null<Call*> call) override;
|
||||||
void callFailed(gsl::not_null<Call*> call) override;
|
void callFailed(not_null<Call*> call) override;
|
||||||
void callRedial(gsl::not_null<Call*> call) override;
|
void callRedial(not_null<Call*> call) override;
|
||||||
using Sound = Call::Delegate::Sound;
|
using Sound = Call::Delegate::Sound;
|
||||||
void playSound(Sound sound) override;
|
void playSound(Sound sound) override;
|
||||||
void createCall(gsl::not_null<UserData*> user, Call::Type type);
|
void createCall(not_null<UserData*> user, Call::Type type);
|
||||||
void destroyCall(gsl::not_null<Call*> call);
|
void destroyCall(not_null<Call*> call);
|
||||||
void destroyCurrentPanel();
|
void destroyCurrentPanel();
|
||||||
|
|
||||||
void refreshDhConfig();
|
void refreshDhConfig();
|
||||||
|
|
|
@ -61,10 +61,10 @@ protected:
|
||||||
QPoint prepareRippleStartPosition() const override;
|
QPoint prepareRippleStartPosition() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPoint iconPosition(gsl::not_null<const style::CallButton*> st) const;
|
QPoint iconPosition(not_null<const style::CallButton*> st) const;
|
||||||
void mixIconMasks();
|
void mixIconMasks();
|
||||||
|
|
||||||
gsl::not_null<const style::CallButton*> _stFrom;
|
not_null<const style::CallButton*> _stFrom;
|
||||||
const style::CallButton *_stTo = nullptr;
|
const style::CallButton *_stTo = nullptr;
|
||||||
float64 _progress = 0.;
|
float64 _progress = 0.;
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ void Panel::Button::paintEvent(QPaintEvent *e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QPoint Panel::Button::iconPosition(gsl::not_null<const style::CallButton*> st) const {
|
QPoint Panel::Button::iconPosition(not_null<const style::CallButton*> st) const {
|
||||||
auto result = st->button.iconPosition;
|
auto result = st->button.iconPosition;
|
||||||
if (result.x() < 0) {
|
if (result.x() < 0) {
|
||||||
result.setX((width() - st->button.icon.width()) / 2);
|
result.setX((width() - st->button.icon.width()) / 2);
|
||||||
|
@ -240,7 +240,7 @@ QImage Panel::Button::prepareRippleMask() const {
|
||||||
return Ui::RippleAnimation::ellipseMask(QSize(_stFrom->button.rippleAreaSize, _stFrom->button.rippleAreaSize));
|
return Ui::RippleAnimation::ellipseMask(QSize(_stFrom->button.rippleAreaSize, _stFrom->button.rippleAreaSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
Panel::Panel(gsl::not_null<Call*> call)
|
Panel::Panel(not_null<Call*> call)
|
||||||
: _call(call)
|
: _call(call)
|
||||||
, _user(call->user())
|
, _user(call->user())
|
||||||
, _answerHangupRedial(this, st::callAnswer, &st::callHangup)
|
, _answerHangupRedial(this, st::callAnswer, &st::callHangup)
|
||||||
|
@ -264,7 +264,7 @@ void Panel::showAndActivate() {
|
||||||
setFocus();
|
setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panel::replaceCall(gsl::not_null<Call*> call) {
|
void Panel::replaceCall(not_null<Call*> call) {
|
||||||
_call = call;
|
_call = call;
|
||||||
_user = call->user();
|
_user = call->user();
|
||||||
reinitControls();
|
reinitControls();
|
||||||
|
|
|
@ -36,10 +36,10 @@ namespace Calls {
|
||||||
|
|
||||||
class Panel : public TWidget, private base::Subscriber, private Ui::AbstractTooltipShower {
|
class Panel : public TWidget, private base::Subscriber, private Ui::AbstractTooltipShower {
|
||||||
public:
|
public:
|
||||||
Panel(gsl::not_null<Call*> call);
|
Panel(not_null<Call*> call);
|
||||||
|
|
||||||
void showAndActivate();
|
void showAndActivate();
|
||||||
void replaceCall(gsl::not_null<Call*> call);
|
void replaceCall(not_null<Call*> call);
|
||||||
void hideAndDestroy();
|
void hideAndDestroy();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -89,7 +89,7 @@ private:
|
||||||
void destroyDelayed();
|
void destroyDelayed();
|
||||||
|
|
||||||
Call *_call = nullptr;
|
Call *_call = nullptr;
|
||||||
gsl::not_null<UserData*> _user;
|
not_null<UserData*> _user;
|
||||||
|
|
||||||
bool _useTransparency = true;
|
bool _useTransparency = true;
|
||||||
style::margins _padding;
|
style::margins _padding;
|
||||||
|
|
|
@ -52,7 +52,7 @@ const style::TextStyle &BotKeyboard::Style::textStyle() const {
|
||||||
return st::botKbStyle;
|
return st::botKbStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BotKeyboard::Style::repaint(gsl::not_null<const HistoryItem*> item) const {
|
void BotKeyboard::Style::repaint(not_null<const HistoryItem*> item) const {
|
||||||
_parent->update();
|
_parent->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ private:
|
||||||
|
|
||||||
void startPaint(Painter &p) const override;
|
void startPaint(Painter &p) const override;
|
||||||
const style::TextStyle &textStyle() const override;
|
const style::TextStyle &textStyle() const override;
|
||||||
void repaint(gsl::not_null<const HistoryItem*> item) const override;
|
void repaint(not_null<const HistoryItem*> item) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintButtonBg(Painter &p, const QRect &rect, float64 howMuchOver) const override;
|
void paintButtonBg(Painter &p, const QRect &rect, float64 howMuchOver) const override;
|
||||||
|
|
|
@ -35,7 +35,7 @@ constexpr auto kEmojiPanelRowsPerPage = Ui::Emoji::kPanelRowsPerPage;
|
||||||
|
|
||||||
class EmojiListWidget::Footer : public TabbedSelector::InnerFooter {
|
class EmojiListWidget::Footer : public TabbedSelector::InnerFooter {
|
||||||
public:
|
public:
|
||||||
Footer(gsl::not_null<EmojiListWidget*> parent);
|
Footer(not_null<EmojiListWidget*> parent);
|
||||||
|
|
||||||
void setCurrentSectionIcon(Section section);
|
void setCurrentSectionIcon(Section section);
|
||||||
|
|
||||||
|
@ -46,12 +46,12 @@ private:
|
||||||
void prepareSection(int &left, int top, int _width, Ui::IconButton *sectionIcon, Section section);
|
void prepareSection(int &left, int top, int _width, Ui::IconButton *sectionIcon, Section section);
|
||||||
void setActiveSection(Section section);
|
void setActiveSection(Section section);
|
||||||
|
|
||||||
gsl::not_null<EmojiListWidget*> _pan;
|
not_null<EmojiListWidget*> _pan;
|
||||||
std::array<object_ptr<Ui::IconButton>, kEmojiSectionCount> _sections;
|
std::array<object_ptr<Ui::IconButton>, kEmojiSectionCount> _sections;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
EmojiListWidget::Footer::Footer(gsl::not_null<EmojiListWidget*> parent) : InnerFooter(parent)
|
EmojiListWidget::Footer::Footer(not_null<EmojiListWidget*> parent) : InnerFooter(parent)
|
||||||
, _pan(parent)
|
, _pan(parent)
|
||||||
, _sections { {
|
, _sections { {
|
||||||
object_ptr<Ui::IconButton>(this, st::emojiCategoryRecent),
|
object_ptr<Ui::IconButton>(this, st::emojiCategoryRecent),
|
||||||
|
@ -302,7 +302,7 @@ void EmojiColorPicker::drawVariant(Painter &p, int variant) {
|
||||||
p.drawPixmapLeft(w.x() + (st::emojiPanSize.width() - (esize / cIntRetinaFactor())) / 2, w.y() + (st::emojiPanSize.height() - (esize / cIntRetinaFactor())) / 2, width(), App::emojiLarge(), QRect(_variants[variant]->x() * esize, _variants[variant]->y() * esize, esize, esize));
|
p.drawPixmapLeft(w.x() + (st::emojiPanSize.width() - (esize / cIntRetinaFactor())) / 2, w.y() + (st::emojiPanSize.height() - (esize / cIntRetinaFactor())) / 2, width(), App::emojiLarge(), QRect(_variants[variant]->x() * esize, _variants[variant]->y() * esize, esize, esize));
|
||||||
}
|
}
|
||||||
|
|
||||||
EmojiListWidget::EmojiListWidget(QWidget *parent, gsl::not_null<Window::Controller*> controller) : Inner(parent, controller)
|
EmojiListWidget::EmojiListWidget(QWidget *parent, not_null<Window::Controller*> controller) : Inner(parent, controller)
|
||||||
, _picker(this) {
|
, _picker(this) {
|
||||||
resize(st::emojiPanWidth - st::emojiScroll.width - st::buttonRadius, countHeight());
|
resize(st::emojiPanWidth - st::emojiScroll.width - st::buttonRadius, countHeight());
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ class EmojiListWidget : public TabbedSelector::Inner {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EmojiListWidget(QWidget *parent, gsl::not_null<Window::Controller*> controller);
|
EmojiListWidget(QWidget *parent, not_null<Window::Controller*> controller);
|
||||||
|
|
||||||
using Section = Ui::Emoji::Section;
|
using Section = Ui::Emoji::Section;
|
||||||
|
|
||||||
|
|
|
@ -37,14 +37,14 @@ constexpr auto kRowLimit = 5;
|
||||||
|
|
||||||
class SuggestionsWidget::Row {
|
class SuggestionsWidget::Row {
|
||||||
public:
|
public:
|
||||||
Row(gsl::not_null<EmojiPtr> emoji, const QString &label, const QString &replacement);
|
Row(not_null<EmojiPtr> emoji, const QString &label, const QString &replacement);
|
||||||
Row(const Row &other) = delete;
|
Row(const Row &other) = delete;
|
||||||
Row &operator=(const Row &other) = delete;
|
Row &operator=(const Row &other) = delete;
|
||||||
Row(Row &&other) = default;
|
Row(Row &&other) = default;
|
||||||
Row &operator=(Row &&other) = default;
|
Row &operator=(Row &&other) = default;
|
||||||
~Row();
|
~Row();
|
||||||
|
|
||||||
gsl::not_null<EmojiPtr> emoji() const {
|
not_null<EmojiPtr> emoji() const {
|
||||||
return _emoji;
|
return _emoji;
|
||||||
}
|
}
|
||||||
const QString &label() const {
|
const QString &label() const {
|
||||||
|
@ -64,14 +64,14 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
gsl::not_null<EmojiPtr> _emoji;
|
not_null<EmojiPtr> _emoji;
|
||||||
QString _label;
|
QString _label;
|
||||||
QString _replacement;
|
QString _replacement;
|
||||||
std::unique_ptr<RippleAnimation> _ripple;
|
std::unique_ptr<RippleAnimation> _ripple;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
SuggestionsWidget::Row::Row(gsl::not_null<EmojiPtr> emoji, const QString &label, const QString &replacement)
|
SuggestionsWidget::Row::Row(not_null<EmojiPtr> emoji, const QString &label, const QString &replacement)
|
||||||
: _emoji(emoji)
|
: _emoji(emoji)
|
||||||
, _label(label)
|
, _label(label)
|
||||||
, _replacement(replacement) {
|
, _replacement(replacement) {
|
||||||
|
@ -359,7 +359,7 @@ void SuggestionsWidget::leaveEventHook(QEvent *e) {
|
||||||
return TWidget::leaveEventHook(e);
|
return TWidget::leaveEventHook(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
SuggestionsController::SuggestionsController(QWidget *parent, gsl::not_null<QTextEdit*> field) : QObject(nullptr)
|
SuggestionsController::SuggestionsController(QWidget *parent, not_null<QTextEdit*> field) : QObject(nullptr)
|
||||||
, _field(field)
|
, _field(field)
|
||||||
, _container(parent, st::emojiSuggestionsDropdown)
|
, _container(parent, st::emojiSuggestionsDropdown)
|
||||||
, _suggestions(_container->setOwnedWidget(object_ptr<Ui::Emoji::SuggestionsWidget>(parent, st::emojiSuggestionsMenu))) {
|
, _suggestions(_container->setOwnedWidget(object_ptr<Ui::Emoji::SuggestionsWidget>(parent, st::emojiSuggestionsMenu))) {
|
||||||
|
|
|
@ -65,7 +65,7 @@ private:
|
||||||
void triggerSelectedRow();
|
void triggerSelectedRow();
|
||||||
void triggerRow(const Row &row);
|
void triggerRow(const Row &row);
|
||||||
|
|
||||||
gsl::not_null<const style::Menu*> _st;
|
not_null<const style::Menu*> _st;
|
||||||
|
|
||||||
QString _query;
|
QString _query;
|
||||||
std::vector<Row> _rows;
|
std::vector<Row> _rows;
|
||||||
|
@ -79,7 +79,7 @@ private:
|
||||||
|
|
||||||
class SuggestionsController : public QObject, private base::Subscriber {
|
class SuggestionsController : public QObject, private base::Subscriber {
|
||||||
public:
|
public:
|
||||||
SuggestionsController(QWidget *parent, gsl::not_null<QTextEdit*> field);
|
SuggestionsController(QWidget *parent, not_null<QTextEdit*> field);
|
||||||
|
|
||||||
void raise();
|
void raise();
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ constexpr auto kSearchBotUsername = str_const("gif");
|
||||||
|
|
||||||
class GifsListWidget::Footer : public TabbedSelector::InnerFooter {
|
class GifsListWidget::Footer : public TabbedSelector::InnerFooter {
|
||||||
public:
|
public:
|
||||||
Footer(gsl::not_null<GifsListWidget*> parent);
|
Footer(not_null<GifsListWidget*> parent);
|
||||||
|
|
||||||
void stealFocus();
|
void stealFocus();
|
||||||
void returnFocus();
|
void returnFocus();
|
||||||
|
@ -59,7 +59,7 @@ protected:
|
||||||
void processPanelHideFinished() override;
|
void processPanelHideFinished() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
gsl::not_null<GifsListWidget*> _pan;
|
not_null<GifsListWidget*> _pan;
|
||||||
|
|
||||||
object_ptr<Ui::InputField> _field;
|
object_ptr<Ui::InputField> _field;
|
||||||
object_ptr<Ui::CrossButton> _cancel;
|
object_ptr<Ui::CrossButton> _cancel;
|
||||||
|
@ -68,7 +68,7 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GifsListWidget::Footer::Footer(gsl::not_null<GifsListWidget*> parent) : InnerFooter(parent)
|
GifsListWidget::Footer::Footer(not_null<GifsListWidget*> parent) : InnerFooter(parent)
|
||||||
, _pan(parent)
|
, _pan(parent)
|
||||||
, _field(this, st::gifsSearchField, langFactory(lng_gifs_search))
|
, _field(this, st::gifsSearchField, langFactory(lng_gifs_search))
|
||||||
, _cancel(this, st::gifsSearchCancel) {
|
, _cancel(this, st::gifsSearchCancel) {
|
||||||
|
@ -120,7 +120,7 @@ void GifsListWidget::Footer::processPanelHideFinished() {
|
||||||
//_field->setText(QString());
|
//_field->setText(QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
GifsListWidget::GifsListWidget(QWidget *parent, gsl::not_null<Window::Controller*> controller) : Inner(parent, controller)
|
GifsListWidget::GifsListWidget(QWidget *parent, not_null<Window::Controller*> controller) : Inner(parent, controller)
|
||||||
, _section(Section::Gifs) {
|
, _section(Section::Gifs) {
|
||||||
resize(st::emojiPanWidth - st::emojiScroll.width - st::buttonRadius, countHeight());
|
resize(st::emojiPanWidth - st::emojiScroll.width - st::buttonRadius, countHeight());
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ class GifsListWidget : public TabbedSelector::Inner, public InlineBots::Layout::
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GifsListWidget(QWidget *parent, gsl::not_null<Window::Controller*> controller);
|
GifsListWidget(QWidget *parent, not_null<Window::Controller*> controller);
|
||||||
|
|
||||||
void refreshRecent() override;
|
void refreshRecent() override;
|
||||||
void preloadImages() override;
|
void preloadImages() override;
|
||||||
|
|
|
@ -111,7 +111,7 @@ std::unique_ptr<QMimeData> MimeDataFromTextWithEntities(const TextWithEntities &
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageField::MessageField(QWidget *parent, gsl::not_null<Window::Controller*> controller, const style::FlatTextarea &st, base::lambda<QString()> placeholderFactory, const QString &val) : Ui::FlatTextarea(parent, st, std::move(placeholderFactory), val)
|
MessageField::MessageField(QWidget *parent, not_null<Window::Controller*> controller, const style::FlatTextarea &st, base::lambda<QString()> placeholderFactory, const QString &val) : Ui::FlatTextarea(parent, st, std::move(placeholderFactory), val)
|
||||||
, _controller(controller) {
|
, _controller(controller) {
|
||||||
setMinHeight(st::historySendSize.height() - 2 * st::historySendPadding);
|
setMinHeight(st::historySendSize.height() - 2 * st::historySendPadding);
|
||||||
setMaxHeight(st::historyComposeFieldMaxHeight);
|
setMaxHeight(st::historyComposeFieldMaxHeight);
|
||||||
|
|
|
@ -37,7 +37,7 @@ class MessageField final : public Ui::FlatTextarea {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MessageField(QWidget *parent, gsl::not_null<Window::Controller*> controller, const style::FlatTextarea &st, base::lambda<QString()> placeholderFactory = base::lambda<QString()>(), const QString &val = QString());
|
MessageField(QWidget *parent, not_null<Window::Controller*> controller, const style::FlatTextarea &st, base::lambda<QString()> placeholderFactory = base::lambda<QString()>(), const QString &val = QString());
|
||||||
|
|
||||||
bool hasSendText() const;
|
bool hasSendText() const;
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ protected:
|
||||||
void insertFromMimeData(const QMimeData *source) override;
|
void insertFromMimeData(const QMimeData *source) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
gsl::not_null<Window::Controller*> _controller;
|
not_null<Window::Controller*> _controller;
|
||||||
base::lambda<bool(const QMimeData *data)> _insertFromMimeDataHook;
|
base::lambda<bool(const QMimeData *data)> _insertFromMimeDataHook;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -183,7 +183,7 @@ void MarkFeaturedAsRead(uint64 setId) {
|
||||||
FeaturedReaderInstance->scheduleRead(setId);
|
FeaturedReaderInstance->scheduleRead(setId);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsFaved(gsl::not_null<DocumentData*> document) {
|
bool IsFaved(not_null<DocumentData*> document) {
|
||||||
auto it = Global::StickerSets().constFind(FavedSetId);
|
auto it = Global::StickerSets().constFind(FavedSetId);
|
||||||
return (it != Global::StickerSets().cend()) && it->stickers.contains(document);
|
return (it != Global::StickerSets().cend()) && it->stickers.contains(document);
|
||||||
}
|
}
|
||||||
|
@ -209,8 +209,8 @@ void CheckFavedLimit(Set &set) {
|
||||||
|
|
||||||
void PushFavedToFront(
|
void PushFavedToFront(
|
||||||
Set &set,
|
Set &set,
|
||||||
gsl::not_null<DocumentData*> document,
|
not_null<DocumentData*> document,
|
||||||
const std::vector<gsl::not_null<EmojiPtr>> &emojiList) {
|
const std::vector<not_null<EmojiPtr>> &emojiList) {
|
||||||
set.stickers.push_front(document);
|
set.stickers.push_front(document);
|
||||||
for (auto emoji : emojiList) {
|
for (auto emoji : emojiList) {
|
||||||
set.emoji[emoji].push_front(document);
|
set.emoji[emoji].push_front(document);
|
||||||
|
@ -236,9 +236,9 @@ void MoveFavedToFront(Set &set, int index) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RequestSetToPushFaved(gsl::not_null<DocumentData*> document);
|
void RequestSetToPushFaved(not_null<DocumentData*> document);
|
||||||
|
|
||||||
void SetIsFaved(gsl::not_null<DocumentData*> document, base::optional<std::vector<gsl::not_null<EmojiPtr>>> emojiList = base::none) {
|
void SetIsFaved(not_null<DocumentData*> document, base::optional<std::vector<not_null<EmojiPtr>>> emojiList = base::none) {
|
||||||
auto &sets = Global::RefStickerSets();
|
auto &sets = Global::RefStickerSets();
|
||||||
auto it = sets.find(FavedSetId);
|
auto it = sets.find(FavedSetId);
|
||||||
if (it == sets.end()) {
|
if (it == sets.end()) {
|
||||||
|
@ -263,8 +263,8 @@ void SetIsFaved(gsl::not_null<DocumentData*> document, base::optional<std::vecto
|
||||||
App::main()->onStickersInstalled(FavedSetId);
|
App::main()->onStickersInstalled(FavedSetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RequestSetToPushFaved(gsl::not_null<DocumentData*> document) {
|
void RequestSetToPushFaved(not_null<DocumentData*> document) {
|
||||||
auto addAnyway = [document](std::vector<gsl::not_null<EmojiPtr>> list) {
|
auto addAnyway = [document](std::vector<not_null<EmojiPtr>> list) {
|
||||||
if (list.empty()) {
|
if (list.empty()) {
|
||||||
if (auto sticker = document->sticker()) {
|
if (auto sticker = document->sticker()) {
|
||||||
if (auto emoji = Ui::Emoji::Find(sticker->alt)) {
|
if (auto emoji = Ui::Emoji::Find(sticker->alt)) {
|
||||||
|
@ -276,7 +276,7 @@ void RequestSetToPushFaved(gsl::not_null<DocumentData*> document) {
|
||||||
};
|
};
|
||||||
MTP::send(MTPmessages_GetStickerSet(document->sticker()->set), rpcDone([document, addAnyway](const MTPmessages_StickerSet &result) {
|
MTP::send(MTPmessages_GetStickerSet(document->sticker()->set), rpcDone([document, addAnyway](const MTPmessages_StickerSet &result) {
|
||||||
Expects(result.type() == mtpc_messages_stickerSet);
|
Expects(result.type() == mtpc_messages_stickerSet);
|
||||||
auto list = std::vector<gsl::not_null<EmojiPtr>>();
|
auto list = std::vector<not_null<EmojiPtr>>();
|
||||||
auto &d = result.c_messages_stickerSet();
|
auto &d = result.c_messages_stickerSet();
|
||||||
list.reserve(d.vpacks.v.size());
|
list.reserve(d.vpacks.v.size());
|
||||||
for_const (auto &mtpPack, d.vpacks.v) {
|
for_const (auto &mtpPack, d.vpacks.v) {
|
||||||
|
@ -301,7 +301,7 @@ void RequestSetToPushFaved(gsl::not_null<DocumentData*> document) {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetIsNotFaved(gsl::not_null<DocumentData*> document) {
|
void SetIsNotFaved(not_null<DocumentData*> document) {
|
||||||
auto &sets = Global::RefStickerSets();
|
auto &sets = Global::RefStickerSets();
|
||||||
auto it = sets.find(FavedSetId);
|
auto it = sets.find(FavedSetId);
|
||||||
if (it == sets.end()) {
|
if (it == sets.end()) {
|
||||||
|
@ -330,7 +330,7 @@ void SetIsNotFaved(gsl::not_null<DocumentData*> document) {
|
||||||
Auth().data().stickersUpdated().notify(true);
|
Auth().data().stickersUpdated().notify(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetFaved(gsl::not_null<DocumentData*> document, bool faved) {
|
void SetFaved(not_null<DocumentData*> document, bool faved) {
|
||||||
if (faved) {
|
if (faved) {
|
||||||
SetIsFaved(document);
|
SetIsFaved(document);
|
||||||
} else {
|
} else {
|
||||||
|
@ -629,7 +629,7 @@ void GifsReceived(const QVector<MTPDocument> &items, int32 hash) {
|
||||||
Auth().data().savedGifsUpdated().notify();
|
Auth().data().savedGifsUpdated().notify();
|
||||||
}
|
}
|
||||||
|
|
||||||
StickerPack GetListByEmoji(gsl::not_null<EmojiPtr> emoji) {
|
StickerPack GetListByEmoji(not_null<EmojiPtr> emoji) {
|
||||||
auto original = emoji->original();
|
auto original = emoji->original();
|
||||||
auto result = StickerPack();
|
auto result = StickerPack();
|
||||||
auto setsToRequest = QMap<uint64, uint64>();
|
auto setsToRequest = QMap<uint64, uint64>();
|
||||||
|
@ -673,8 +673,8 @@ StickerPack GetListByEmoji(gsl::not_null<EmojiPtr> emoji) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
base::optional<std::vector<gsl::not_null<EmojiPtr>>> GetEmojiListFromSet(
|
base::optional<std::vector<not_null<EmojiPtr>>> GetEmojiListFromSet(
|
||||||
gsl::not_null<DocumentData*> document) {
|
not_null<DocumentData*> document) {
|
||||||
if (auto sticker = document->sticker()) {
|
if (auto sticker = document->sticker()) {
|
||||||
auto &inputSet = sticker->set;
|
auto &inputSet = sticker->set;
|
||||||
if (inputSet.type() != mtpc_inputStickerSetID) {
|
if (inputSet.type() != mtpc_inputStickerSetID) {
|
||||||
|
@ -685,7 +685,7 @@ base::optional<std::vector<gsl::not_null<EmojiPtr>>> GetEmojiListFromSet(
|
||||||
if (it == sets.cend()) {
|
if (it == sets.cend()) {
|
||||||
return base::none;
|
return base::none;
|
||||||
}
|
}
|
||||||
auto result = std::vector<gsl::not_null<EmojiPtr>>();
|
auto result = std::vector<not_null<EmojiPtr>>();
|
||||||
for (auto i = it->emoji.cbegin(), e = it->emoji.cend(); i != e; ++i) {
|
for (auto i = it->emoji.cbegin(), e = it->emoji.cend(); i != e; ++i) {
|
||||||
if (i->contains(document)) {
|
if (i->contains(document)) {
|
||||||
result.push_back(i.key());
|
result.push_back(i.key());
|
||||||
|
|
|
@ -31,17 +31,17 @@ bool ApplyArchivedResultFake(); // For testing.
|
||||||
void InstallLocally(uint64 setId);
|
void InstallLocally(uint64 setId);
|
||||||
void UndoInstallLocally(uint64 setId);
|
void UndoInstallLocally(uint64 setId);
|
||||||
void MarkFeaturedAsRead(uint64 setId);
|
void MarkFeaturedAsRead(uint64 setId);
|
||||||
bool IsFaved(gsl::not_null<DocumentData*> document);
|
bool IsFaved(not_null<DocumentData*> document);
|
||||||
void SetFaved(gsl::not_null<DocumentData*> document, bool faved);
|
void SetFaved(not_null<DocumentData*> document, bool faved);
|
||||||
|
|
||||||
void SetsReceived(const QVector<MTPStickerSet> &data, int32 hash);
|
void SetsReceived(const QVector<MTPStickerSet> &data, int32 hash);
|
||||||
void SpecialSetReceived(uint64 setId, const QString &setTitle, const QVector<MTPDocument> &items, int32 hash, const QVector<MTPStickerPack> &packs = QVector<MTPStickerPack>());
|
void SpecialSetReceived(uint64 setId, const QString &setTitle, const QVector<MTPDocument> &items, int32 hash, const QVector<MTPStickerPack> &packs = QVector<MTPStickerPack>());
|
||||||
void FeaturedSetsReceived(const QVector<MTPStickerSetCovered> &data, const QVector<MTPlong> &unread, int32 hash);
|
void FeaturedSetsReceived(const QVector<MTPStickerSetCovered> &data, const QVector<MTPlong> &unread, int32 hash);
|
||||||
void GifsReceived(const QVector<MTPDocument> &items, int32 hash);
|
void GifsReceived(const QVector<MTPDocument> &items, int32 hash);
|
||||||
|
|
||||||
StickerPack GetListByEmoji(gsl::not_null<EmojiPtr> emoji);
|
StickerPack GetListByEmoji(not_null<EmojiPtr> emoji);
|
||||||
base::optional<std::vector<gsl::not_null<EmojiPtr>>> GetEmojiListFromSet(
|
base::optional<std::vector<not_null<EmojiPtr>>> GetEmojiListFromSet(
|
||||||
gsl::not_null<DocumentData*> document);
|
not_null<DocumentData*> document);
|
||||||
|
|
||||||
Set *FeedSet(const MTPDstickerSet &data);
|
Set *FeedSet(const MTPDstickerSet &data);
|
||||||
Set *FeedSetFull(const MTPmessages_StickerSet &data);
|
Set *FeedSetFull(const MTPmessages_StickerSet &data);
|
||||||
|
|
|
@ -60,7 +60,7 @@ struct StickerIcon {
|
||||||
|
|
||||||
class StickersListWidget::Footer : public TabbedSelector::InnerFooter, private base::Subscriber {
|
class StickersListWidget::Footer : public TabbedSelector::InnerFooter, private base::Subscriber {
|
||||||
public:
|
public:
|
||||||
Footer(gsl::not_null<StickersListWidget*> parent);
|
Footer(not_null<StickersListWidget*> parent);
|
||||||
|
|
||||||
void preloadImages();
|
void preloadImages();
|
||||||
void validateSelectedIcon(uint64 setId, ValidateIconAnimations animations);
|
void validateSelectedIcon(uint64 setId, ValidateIconAnimations animations);
|
||||||
|
@ -88,7 +88,7 @@ private:
|
||||||
void paintStickerSettingsIcon(Painter &p) const;
|
void paintStickerSettingsIcon(Painter &p) const;
|
||||||
void paintFeaturedStickerSetsBadge(Painter &p, int iconLeft) const;
|
void paintFeaturedStickerSetsBadge(Painter &p, int iconLeft) const;
|
||||||
|
|
||||||
gsl::not_null<StickersListWidget*> _pan;
|
not_null<StickersListWidget*> _pan;
|
||||||
|
|
||||||
static constexpr auto kVisibleIconsCount = 8;
|
static constexpr auto kVisibleIconsCount = 8;
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
StickersListWidget::Footer::Footer(gsl::not_null<StickersListWidget*> parent) : InnerFooter(parent)
|
StickersListWidget::Footer::Footer(not_null<StickersListWidget*> parent) : InnerFooter(parent)
|
||||||
, _pan(parent)
|
, _pan(parent)
|
||||||
, _a_icons(animation(this, &Footer::step_icons)) {
|
, _a_icons(animation(this, &Footer::step_icons)) {
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
|
@ -434,7 +434,7 @@ void StickersListWidget::Footer::step_icons(TimeMs ms, bool timer) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StickersListWidget::StickersListWidget(QWidget *parent, gsl::not_null<Window::Controller*> controller) : Inner(parent, controller)
|
StickersListWidget::StickersListWidget(QWidget *parent, not_null<Window::Controller*> controller) : Inner(parent, controller)
|
||||||
, _section(Section::Stickers)
|
, _section(Section::Stickers)
|
||||||
, _megagroupSetAbout(st::emojiPanWidth - st::emojiScroll.width - st::emojiPanHeaderLeft)
|
, _megagroupSetAbout(st::emojiPanWidth - st::emojiScroll.width - st::emojiPanHeaderLeft)
|
||||||
, _addText(lang(lng_stickers_featured_add).toUpper())
|
, _addText(lang(lng_stickers_featured_add).toUpper())
|
||||||
|
|
|
@ -39,7 +39,7 @@ class StickersListWidget : public TabbedSelector::Inner, private base::Subscribe
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
StickersListWidget(QWidget *parent, gsl::not_null<Window::Controller*> controller);
|
StickersListWidget(QWidget *parent, not_null<Window::Controller*> controller);
|
||||||
|
|
||||||
void refreshRecent() override;
|
void refreshRecent() override;
|
||||||
void preloadImages() override;
|
void preloadImages() override;
|
||||||
|
|
|
@ -34,10 +34,10 @@ constexpr auto kDelayedHideTimeoutMs = 3000;
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
TabbedPanel::TabbedPanel(QWidget *parent, gsl::not_null<Window::Controller*> controller) : TabbedPanel(parent, controller, object_ptr<TabbedSelector>(nullptr, controller)) {
|
TabbedPanel::TabbedPanel(QWidget *parent, not_null<Window::Controller*> controller) : TabbedPanel(parent, controller, object_ptr<TabbedSelector>(nullptr, controller)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TabbedPanel::TabbedPanel(QWidget *parent, gsl::not_null<Window::Controller*> controller, object_ptr<TabbedSelector> selector) : TWidget(parent)
|
TabbedPanel::TabbedPanel(QWidget *parent, not_null<Window::Controller*> controller, object_ptr<TabbedSelector> selector) : TWidget(parent)
|
||||||
, _controller(controller)
|
, _controller(controller)
|
||||||
, _selector(std::move(selector)) {
|
, _selector(std::move(selector)) {
|
||||||
_selector->setParent(this);
|
_selector->setParent(this);
|
||||||
|
|
|
@ -39,8 +39,8 @@ class TabbedPanel : public TWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TabbedPanel(QWidget *parent, gsl::not_null<Window::Controller*> controller);
|
TabbedPanel(QWidget *parent, not_null<Window::Controller*> controller);
|
||||||
TabbedPanel(QWidget *parent, gsl::not_null<Window::Controller*> controller, object_ptr<TabbedSelector> selector);
|
TabbedPanel(QWidget *parent, not_null<Window::Controller*> controller, object_ptr<TabbedSelector> selector);
|
||||||
|
|
||||||
object_ptr<TabbedSelector> takeSelector();
|
object_ptr<TabbedSelector> takeSelector();
|
||||||
QPointer<TabbedSelector> getSelector() const;
|
QPointer<TabbedSelector> getSelector() const;
|
||||||
|
@ -106,7 +106,7 @@ private:
|
||||||
bool preventAutoHide() const;
|
bool preventAutoHide() const;
|
||||||
void updateContentHeight();
|
void updateContentHeight();
|
||||||
|
|
||||||
gsl::not_null<Window::Controller*> _controller;
|
not_null<Window::Controller*> _controller;
|
||||||
object_ptr<TabbedSelector> _selector;
|
object_ptr<TabbedSelector> _selector;
|
||||||
|
|
||||||
int _contentMaxHeight = 0;
|
int _contentMaxHeight = 0;
|
||||||
|
|
|
@ -25,10 +25,10 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
|
|
||||||
namespace ChatHelpers {
|
namespace ChatHelpers {
|
||||||
|
|
||||||
TabbedSection::TabbedSection(QWidget *parent, gsl::not_null<Window::Controller*> controller) : TabbedSection(parent, controller, object_ptr<TabbedSelector>(this, controller)) {
|
TabbedSection::TabbedSection(QWidget *parent, not_null<Window::Controller*> controller) : TabbedSection(parent, controller, object_ptr<TabbedSelector>(this, controller)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
TabbedSection::TabbedSection(QWidget *parent, gsl::not_null<Window::Controller*> controller, object_ptr<TabbedSelector> selector) : Window::AbstractSectionWidget(parent, controller)
|
TabbedSection::TabbedSection(QWidget *parent, not_null<Window::Controller*> controller, object_ptr<TabbedSelector> selector) : Window::AbstractSectionWidget(parent, controller)
|
||||||
, _selector(std::move(selector)) {
|
, _selector(std::move(selector)) {
|
||||||
resize(st::emojiPanWidth, st::emojiPanMaxHeight);
|
resize(st::emojiPanWidth, st::emojiPanMaxHeight);
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,8 @@ class TabbedSelector;
|
||||||
|
|
||||||
class TabbedSection : public Window::AbstractSectionWidget {
|
class TabbedSection : public Window::AbstractSectionWidget {
|
||||||
public:
|
public:
|
||||||
TabbedSection(QWidget *parent, gsl::not_null<Window::Controller*> controller);
|
TabbedSection(QWidget *parent, not_null<Window::Controller*> controller);
|
||||||
TabbedSection(QWidget *parent, gsl::not_null<Window::Controller*> controller, object_ptr<TabbedSelector> selector);
|
TabbedSection(QWidget *parent, not_null<Window::Controller*> controller, object_ptr<TabbedSelector> selector);
|
||||||
|
|
||||||
void beforeHiding();
|
void beforeHiding();
|
||||||
void afterShown();
|
void afterShown();
|
||||||
|
|
|
@ -285,7 +285,7 @@ void TabbedSelector::Tab::saveScrollTop() {
|
||||||
_scrollTop = widget()->getVisibleTop();
|
_scrollTop = widget()->getVisibleTop();
|
||||||
}
|
}
|
||||||
|
|
||||||
TabbedSelector::TabbedSelector(QWidget *parent, gsl::not_null<Window::Controller*> controller) : TWidget(parent)
|
TabbedSelector::TabbedSelector(QWidget *parent, not_null<Window::Controller*> controller) : TWidget(parent)
|
||||||
, _tabsSlider(this, st::emojiTabs)
|
, _tabsSlider(this, st::emojiTabs)
|
||||||
, _topShadow(this, st::shadowFg)
|
, _topShadow(this, st::shadowFg)
|
||||||
, _bottomShadow(this, st::shadowFg)
|
, _bottomShadow(this, st::shadowFg)
|
||||||
|
@ -669,15 +669,15 @@ void TabbedSelector::switchTab() {
|
||||||
Auth().saveDataDelayed(kSaveChosenTabTimeout);
|
Auth().saveDataDelayed(kSaveChosenTabTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
gsl::not_null<EmojiListWidget*> TabbedSelector::emoji() const {
|
not_null<EmojiListWidget*> TabbedSelector::emoji() const {
|
||||||
return static_cast<EmojiListWidget*>(getTab(SelectorTab::Emoji)->widget().get());
|
return static_cast<EmojiListWidget*>(getTab(SelectorTab::Emoji)->widget().get());
|
||||||
}
|
}
|
||||||
|
|
||||||
gsl::not_null<StickersListWidget*> TabbedSelector::stickers() const {
|
not_null<StickersListWidget*> TabbedSelector::stickers() const {
|
||||||
return static_cast<StickersListWidget*>(getTab(SelectorTab::Stickers)->widget().get());
|
return static_cast<StickersListWidget*>(getTab(SelectorTab::Stickers)->widget().get());
|
||||||
}
|
}
|
||||||
|
|
||||||
gsl::not_null<GifsListWidget*> TabbedSelector::gifs() const {
|
not_null<GifsListWidget*> TabbedSelector::gifs() const {
|
||||||
return static_cast<GifsListWidget*>(getTab(SelectorTab::Gifs)->widget().get());
|
return static_cast<GifsListWidget*>(getTab(SelectorTab::Gifs)->widget().get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -697,7 +697,7 @@ void TabbedSelector::scrollToY(int y) {
|
||||||
_topShadow->update();
|
_topShadow->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
TabbedSelector::Inner::Inner(QWidget *parent, gsl::not_null<Window::Controller*> controller) : TWidget(parent)
|
TabbedSelector::Inner::Inner(QWidget *parent, not_null<Window::Controller*> controller) : TWidget(parent)
|
||||||
, _controller(controller) {
|
, _controller(controller) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ class TabbedSelector : public TWidget, private base::Subscriber {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TabbedSelector(QWidget *parent, gsl::not_null<Window::Controller*> controller);
|
TabbedSelector(QWidget *parent, not_null<Window::Controller*> controller);
|
||||||
|
|
||||||
void setRoundRadius(int radius);
|
void setRoundRadius(int radius);
|
||||||
void refreshStickers();
|
void refreshStickers();
|
||||||
|
@ -123,10 +123,10 @@ private:
|
||||||
SelectorTab type() const {
|
SelectorTab type() const {
|
||||||
return _type;
|
return _type;
|
||||||
}
|
}
|
||||||
gsl::not_null<Inner*> widget() const {
|
not_null<Inner*> widget() const {
|
||||||
return _weak;
|
return _weak;
|
||||||
}
|
}
|
||||||
gsl::not_null<InnerFooter*> footer() const {
|
not_null<InnerFooter*> footer() const {
|
||||||
return _footer;
|
return _footer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,21 +164,21 @@ private:
|
||||||
void setWidgetToScrollArea();
|
void setWidgetToScrollArea();
|
||||||
void createTabsSlider();
|
void createTabsSlider();
|
||||||
void switchTab();
|
void switchTab();
|
||||||
gsl::not_null<Tab*> getTab(SelectorTab type) {
|
not_null<Tab*> getTab(SelectorTab type) {
|
||||||
return &_tabs[static_cast<int>(type)];
|
return &_tabs[static_cast<int>(type)];
|
||||||
}
|
}
|
||||||
gsl::not_null<const Tab*> getTab(SelectorTab type) const {
|
not_null<const Tab*> getTab(SelectorTab type) const {
|
||||||
return &_tabs[static_cast<int>(type)];
|
return &_tabs[static_cast<int>(type)];
|
||||||
}
|
}
|
||||||
gsl::not_null<Tab*> currentTab() {
|
not_null<Tab*> currentTab() {
|
||||||
return getTab(_currentTabType);
|
return getTab(_currentTabType);
|
||||||
}
|
}
|
||||||
gsl::not_null<const Tab*> currentTab() const {
|
not_null<const Tab*> currentTab() const {
|
||||||
return getTab(_currentTabType);
|
return getTab(_currentTabType);
|
||||||
}
|
}
|
||||||
gsl::not_null<EmojiListWidget*> emoji() const;
|
not_null<EmojiListWidget*> emoji() const;
|
||||||
gsl::not_null<StickersListWidget*> stickers() const;
|
not_null<StickersListWidget*> stickers() const;
|
||||||
gsl::not_null<GifsListWidget*> gifs() const;
|
not_null<GifsListWidget*> gifs() const;
|
||||||
|
|
||||||
int _roundRadius = 0;
|
int _roundRadius = 0;
|
||||||
int _footerTop = 0;
|
int _footerTop = 0;
|
||||||
|
@ -205,7 +205,7 @@ class TabbedSelector::Inner : public TWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Inner(QWidget *parent, gsl::not_null<Window::Controller*> controller);
|
Inner(QWidget *parent, not_null<Window::Controller*> controller);
|
||||||
|
|
||||||
void setVisibleTopBottom(int visibleTop, int visibleBottom) override;
|
void setVisibleTopBottom(int visibleTop, int visibleBottom) override;
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ signals:
|
||||||
void disableScroll(bool disabled);
|
void disableScroll(bool disabled);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
gsl::not_null<Window::Controller*> controller() const {
|
not_null<Window::Controller*> controller() const {
|
||||||
return _controller;
|
return _controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
gsl::not_null<Window::Controller*> _controller;
|
not_null<Window::Controller*> _controller;
|
||||||
|
|
||||||
int _visibleTop = 0;
|
int _visibleTop = 0;
|
||||||
int _visibleBottom = 0;
|
int _visibleBottom = 0;
|
||||||
|
|
|
@ -27,6 +27,9 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
|
|
||||||
#include "base/build_config.h"
|
#include "base/build_config.h"
|
||||||
|
|
||||||
|
template <typename Type>
|
||||||
|
using not_null = gsl::not_null<Type>;
|
||||||
|
|
||||||
// Custom libc++ build used for old OS X versions already has this.
|
// Custom libc++ build used for old OS X versions already has this.
|
||||||
#ifndef OS_MAC_OLD
|
#ifndef OS_MAC_OLD
|
||||||
|
|
||||||
|
|
|
@ -415,7 +415,7 @@ inline void memsetrnd_bad(T &value) {
|
||||||
|
|
||||||
class ReadLockerAttempt {
|
class ReadLockerAttempt {
|
||||||
public:
|
public:
|
||||||
ReadLockerAttempt(gsl::not_null<QReadWriteLock*> lock) : _lock(lock), _locked(_lock->tryLockForRead()) {
|
ReadLockerAttempt(not_null<QReadWriteLock*> lock) : _lock(lock), _locked(_lock->tryLockForRead()) {
|
||||||
}
|
}
|
||||||
ReadLockerAttempt(const ReadLockerAttempt &other) = delete;
|
ReadLockerAttempt(const ReadLockerAttempt &other) = delete;
|
||||||
ReadLockerAttempt &operator=(const ReadLockerAttempt &other) = delete;
|
ReadLockerAttempt &operator=(const ReadLockerAttempt &other) = delete;
|
||||||
|
@ -437,7 +437,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
gsl::not_null<QReadWriteLock*> _lock;
|
not_null<QReadWriteLock*> _lock;
|
||||||
bool _locked = false;
|
bool _locked = false;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -65,7 +65,7 @@ struct DialogsInner::PeerSearchResult {
|
||||||
Dialogs::RippleRow row;
|
Dialogs::RippleRow row;
|
||||||
};
|
};
|
||||||
|
|
||||||
DialogsInner::DialogsInner(QWidget *parent, gsl::not_null<Window::Controller*> controller, QWidget *main) : SplittedWidget(parent)
|
DialogsInner::DialogsInner(QWidget *parent, not_null<Window::Controller*> controller, QWidget *main) : SplittedWidget(parent)
|
||||||
, _controller(controller)
|
, _controller(controller)
|
||||||
, _dialogs(std::make_unique<Dialogs::IndexedList>(Dialogs::SortMode::Date))
|
, _dialogs(std::make_unique<Dialogs::IndexedList>(Dialogs::SortMode::Date))
|
||||||
, _contactsNoDialogs(std::make_unique<Dialogs::IndexedList>(Dialogs::SortMode::Name))
|
, _contactsNoDialogs(std::make_unique<Dialogs::IndexedList>(Dialogs::SortMode::Name))
|
||||||
|
@ -464,7 +464,7 @@ void DialogsInner::paintSearchInPeer(Painter &p, int fullWidth, bool onlyBackgro
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogsInner::paintSearchInFilter(Painter &p, gsl::not_null<PeerData*> peer, int top, int fullWidth, const Text &text) const {
|
void DialogsInner::paintSearchInFilter(Painter &p, not_null<PeerData*> peer, int top, int fullWidth, const Text &text) const {
|
||||||
auto pen = p.pen();
|
auto pen = p.pen();
|
||||||
peer->paintUserpicLeft(p, st::dialogsPadding.x(), top + (st::dialogsSearchInHeight - st::dialogsSearchInPhotoSize) / 2, getFullWidth(), st::dialogsSearchInPhotoSize);
|
peer->paintUserpicLeft(p, st::dialogsPadding.x(), top + (st::dialogsSearchInHeight - st::dialogsSearchInPhotoSize) / 2, getFullWidth(), st::dialogsSearchInPhotoSize);
|
||||||
|
|
||||||
|
@ -1264,7 +1264,7 @@ void DialogsInner::onParentGeometryChanged() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DialogsInner::handlePeerNameChange(gsl::not_null<PeerData*> peer, const PeerData::Names &oldNames, const PeerData::NameFirstChars &oldChars) {
|
void DialogsInner::handlePeerNameChange(not_null<PeerData*> peer, const PeerData::Names &oldNames, const PeerData::NameFirstChars &oldChars) {
|
||||||
_dialogs->peerNameChanged(Dialogs::Mode::All, peer, oldNames, oldChars);
|
_dialogs->peerNameChanged(Dialogs::Mode::All, peer, oldNames, oldChars);
|
||||||
if (_dialogsImportant) {
|
if (_dialogsImportant) {
|
||||||
_dialogsImportant->peerNameChanged(Dialogs::Mode::Important, peer, oldNames, oldChars);
|
_dialogsImportant->peerNameChanged(Dialogs::Mode::Important, peer, oldNames, oldChars);
|
||||||
|
|
|
@ -42,7 +42,7 @@ class DialogsInner : public Ui::SplittedWidget, public RPCSender, private base::
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DialogsInner(QWidget *parent, gsl::not_null<Window::Controller*> controller, QWidget *main);
|
DialogsInner(QWidget *parent, not_null<Window::Controller*> controller, QWidget *main);
|
||||||
|
|
||||||
void dialogsReceived(const QVector<MTPDialog> &dialogs);
|
void dialogsReceived(const QVector<MTPDialog> &dialogs);
|
||||||
void addSavedPeersAfter(const QDateTime &date);
|
void addSavedPeersAfter(const QDateTime &date);
|
||||||
|
@ -170,7 +170,7 @@ private:
|
||||||
bool isSelected() const {
|
bool isSelected() const {
|
||||||
return _importantSwitchSelected || _selected || (_hashtagSelected >= 0) || (_filteredSelected >= 0) || (_peerSearchSelected >= 0) || (_searchedSelected >= 0);
|
return _importantSwitchSelected || _selected || (_hashtagSelected >= 0) || (_filteredSelected >= 0) || (_peerSearchSelected >= 0) || (_searchedSelected >= 0);
|
||||||
}
|
}
|
||||||
void handlePeerNameChange(gsl::not_null<PeerData*> peer, const PeerData::Names &oldNames, const PeerData::NameFirstChars &oldChars);
|
void handlePeerNameChange(not_null<PeerData*> peer, const PeerData::Names &oldNames, const PeerData::NameFirstChars &oldChars);
|
||||||
|
|
||||||
void itemRemoved(HistoryItem *item);
|
void itemRemoved(HistoryItem *item);
|
||||||
enum class UpdateRowSection {
|
enum class UpdateRowSection {
|
||||||
|
@ -193,7 +193,7 @@ private:
|
||||||
void paintDialog(Painter &p, Dialogs::Row *row, int fullWidth, PeerData *active, PeerData *selected, bool onlyBackground, TimeMs ms);
|
void paintDialog(Painter &p, Dialogs::Row *row, int fullWidth, PeerData *active, PeerData *selected, bool onlyBackground, TimeMs ms);
|
||||||
void paintPeerSearchResult(Painter &p, const PeerSearchResult *result, int fullWidth, bool active, bool selected, bool onlyBackground, TimeMs ms) const;
|
void paintPeerSearchResult(Painter &p, const PeerSearchResult *result, int fullWidth, bool active, bool selected, bool onlyBackground, TimeMs ms) const;
|
||||||
void paintSearchInPeer(Painter &p, int fullWidth, bool onlyBackground, TimeMs ms) const;
|
void paintSearchInPeer(Painter &p, int fullWidth, bool onlyBackground, TimeMs ms) const;
|
||||||
void paintSearchInFilter(Painter &p, gsl::not_null<PeerData*> peer, int top, int fullWidth, const Text &text) const;
|
void paintSearchInFilter(Painter &p, not_null<PeerData*> peer, int top, int fullWidth, const Text &text) const;
|
||||||
|
|
||||||
void clearSelection();
|
void clearSelection();
|
||||||
void clearSearchResults(bool clearPeerSearchResults = true);
|
void clearSearchResults(bool clearPeerSearchResults = true);
|
||||||
|
@ -213,7 +213,7 @@ private:
|
||||||
void savePinnedOrder();
|
void savePinnedOrder();
|
||||||
void step_pinnedShifting(TimeMs ms, bool timer);
|
void step_pinnedShifting(TimeMs ms, bool timer);
|
||||||
|
|
||||||
gsl::not_null<Window::Controller*> _controller;
|
not_null<Window::Controller*> _controller;
|
||||||
|
|
||||||
DialogsList _dialogs;
|
DialogsList _dialogs;
|
||||||
DialogsList _dialogsImportant;
|
DialogsList _dialogsImportant;
|
||||||
|
|
|
@ -27,7 +27,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
|
|
||||||
namespace Dialogs {
|
namespace Dialogs {
|
||||||
|
|
||||||
void ShowSearchFromBox(PeerData *peer, base::lambda<void(gsl::not_null<UserData*>)> callback, base::lambda<void()> closedCallback) {
|
void ShowSearchFromBox(PeerData *peer, base::lambda<void(not_null<UserData*>)> callback, base::lambda<void()> closedCallback) {
|
||||||
auto createController = [peer, callback = std::move(callback)]() -> std::unique_ptr<PeerListController> {
|
auto createController = [peer, callback = std::move(callback)]() -> std::unique_ptr<PeerListController> {
|
||||||
if (peer) {
|
if (peer) {
|
||||||
if (auto chat = peer->asChat()) {
|
if (auto chat = peer->asChat()) {
|
||||||
|
@ -40,14 +40,14 @@ void ShowSearchFromBox(PeerData *peer, base::lambda<void(gsl::not_null<UserData*
|
||||||
};
|
};
|
||||||
if (auto controller = createController()) {
|
if (auto controller = createController()) {
|
||||||
auto subscription = std::make_shared<base::Subscription>();
|
auto subscription = std::make_shared<base::Subscription>();
|
||||||
auto box = Ui::show(Box<PeerListBox>(std::move(controller), [subscription](gsl::not_null<PeerListBox*> box) {
|
auto box = Ui::show(Box<PeerListBox>(std::move(controller), [subscription](not_null<PeerListBox*> box) {
|
||||||
box->addButton(langFactory(lng_cancel), [box, subscription] { box->closeBox(); });
|
box->addButton(langFactory(lng_cancel), [box, subscription] { box->closeBox(); });
|
||||||
}), KeepOtherLayers);
|
}), KeepOtherLayers);
|
||||||
*subscription = box->boxClosing.add_subscription(std::move(closedCallback));
|
*subscription = box->boxClosing.add_subscription(std::move(closedCallback));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatSearchFromController::ChatSearchFromController(gsl::not_null<ChatData*> chat, base::lambda<void(gsl::not_null<UserData*>)> callback) : PeerListController()
|
ChatSearchFromController::ChatSearchFromController(not_null<ChatData*> chat, base::lambda<void(not_null<UserData*>)> callback) : PeerListController()
|
||||||
, _chat(chat)
|
, _chat(chat)
|
||||||
, _callback(std::move(callback)) {
|
, _callback(std::move(callback)) {
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ void ChatSearchFromController::prepare() {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatSearchFromController::rowClicked(gsl::not_null<PeerListRow*> row) {
|
void ChatSearchFromController::rowClicked(not_null<PeerListRow*> row) {
|
||||||
Expects(row->peer()->isUser());
|
Expects(row->peer()->isUser());
|
||||||
_callback(row->peer()->asUser());
|
_callback(row->peer()->asUser());
|
||||||
}
|
}
|
||||||
|
@ -109,13 +109,13 @@ void ChatSearchFromController::checkForEmptyRows() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatSearchFromController::appendRow(gsl::not_null<UserData*> user) {
|
void ChatSearchFromController::appendRow(not_null<UserData*> user) {
|
||||||
if (!delegate()->peerListFindRow(user->id)) {
|
if (!delegate()->peerListFindRow(user->id)) {
|
||||||
delegate()->peerListAppendRow(std::make_unique<PeerListRow>(user));
|
delegate()->peerListAppendRow(std::make_unique<PeerListRow>(user));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ChannelSearchFromController::ChannelSearchFromController(gsl::not_null<ChannelData*> channel, base::lambda<void(gsl::not_null<UserData*>)> callback) : ParticipantsBoxController(channel, ParticipantsBoxController::Role::Members)
|
ChannelSearchFromController::ChannelSearchFromController(not_null<ChannelData*> channel, base::lambda<void(not_null<UserData*>)> callback) : ParticipantsBoxController(channel, ParticipantsBoxController::Role::Members)
|
||||||
, _callback(std::move(callback)) {
|
, _callback(std::move(callback)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,12 +124,12 @@ void ChannelSearchFromController::prepare() {
|
||||||
delegate()->peerListSetTitle(langFactory(lng_search_messages_from));
|
delegate()->peerListSetTitle(langFactory(lng_search_messages_from));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelSearchFromController::rowClicked(gsl::not_null<PeerListRow*> row) {
|
void ChannelSearchFromController::rowClicked(not_null<PeerListRow*> row) {
|
||||||
Expects(row->peer()->isUser());
|
Expects(row->peer()->isUser());
|
||||||
_callback(row->peer()->asUser());
|
_callback(row->peer()->asUser());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<PeerListRow> ChannelSearchFromController::createRow(gsl::not_null<UserData*> user) const {
|
std::unique_ptr<PeerListRow> ChannelSearchFromController::createRow(not_null<UserData*> user) const {
|
||||||
return std::make_unique<PeerListRow>(user);
|
return std::make_unique<PeerListRow>(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,37 +25,37 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
|
|
||||||
namespace Dialogs {
|
namespace Dialogs {
|
||||||
|
|
||||||
void ShowSearchFromBox(PeerData *peer, base::lambda<void(gsl::not_null<UserData*>)> callback, base::lambda<void()> closedCallback);
|
void ShowSearchFromBox(PeerData *peer, base::lambda<void(not_null<UserData*>)> callback, base::lambda<void()> closedCallback);
|
||||||
|
|
||||||
class ChatSearchFromController : public PeerListController, protected base::Subscriber {
|
class ChatSearchFromController : public PeerListController, protected base::Subscriber {
|
||||||
public:
|
public:
|
||||||
ChatSearchFromController(gsl::not_null<ChatData*> chat, base::lambda<void(gsl::not_null<UserData*>)> callback);
|
ChatSearchFromController(not_null<ChatData*> chat, base::lambda<void(not_null<UserData*>)> callback);
|
||||||
|
|
||||||
void prepare() override;
|
void prepare() override;
|
||||||
void rowClicked(gsl::not_null<PeerListRow*> row) override;
|
void rowClicked(not_null<PeerListRow*> row) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void rebuildRows();
|
void rebuildRows();
|
||||||
void checkForEmptyRows();
|
void checkForEmptyRows();
|
||||||
void appendRow(gsl::not_null<UserData*> user);
|
void appendRow(not_null<UserData*> user);
|
||||||
|
|
||||||
gsl::not_null<ChatData*> _chat;
|
not_null<ChatData*> _chat;
|
||||||
base::lambda<void(gsl::not_null<UserData*>)> _callback;
|
base::lambda<void(not_null<UserData*>)> _callback;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class ChannelSearchFromController : public Profile::ParticipantsBoxController {
|
class ChannelSearchFromController : public Profile::ParticipantsBoxController {
|
||||||
public:
|
public:
|
||||||
ChannelSearchFromController(gsl::not_null<ChannelData*> channel, base::lambda<void(gsl::not_null<UserData*>)> callback);
|
ChannelSearchFromController(not_null<ChannelData*> channel, base::lambda<void(not_null<UserData*>)> callback);
|
||||||
|
|
||||||
void prepare() override;
|
void prepare() override;
|
||||||
void rowClicked(gsl::not_null<PeerListRow*> row) override;
|
void rowClicked(not_null<PeerListRow*> row) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::unique_ptr<PeerListRow> createRow(gsl::not_null<UserData*> user) const override;
|
std::unique_ptr<PeerListRow> createRow(not_null<UserData*> user) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
base::lambda<void(gsl::not_null<UserData*>)> _callback;
|
base::lambda<void(not_null<UserData*>)> _callback;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ void DialogsWidget::UpdateButton::paintEvent(QPaintEvent *e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DialogsWidget::DialogsWidget(QWidget *parent, gsl::not_null<Window::Controller*> controller) : Window::AbstractSectionWidget(parent, controller)
|
DialogsWidget::DialogsWidget(QWidget *parent, not_null<Window::Controller*> controller) : Window::AbstractSectionWidget(parent, controller)
|
||||||
, _mainMenuToggle(this, st::dialogsMenuToggle)
|
, _mainMenuToggle(this, st::dialogsMenuToggle)
|
||||||
, _filter(this, st::dialogsFilter, langFactory(lng_dlg_filter))
|
, _filter(this, st::dialogsFilter, langFactory(lng_dlg_filter))
|
||||||
, _chooseFromUser(this, object_ptr<Ui::IconButton>(this, st::dialogsSearchFrom))
|
, _chooseFromUser(this, object_ptr<Ui::IconButton>(this, st::dialogsSearchFrom))
|
||||||
|
@ -870,7 +870,7 @@ void DialogsWidget::clearSearchCache() {
|
||||||
|
|
||||||
void DialogsWidget::showSearchFrom() {
|
void DialogsWidget::showSearchFrom() {
|
||||||
auto peer = _searchInPeer;
|
auto peer = _searchInPeer;
|
||||||
Dialogs::ShowSearchFromBox(peer, base::lambda_guarded(this, [this, peer](gsl::not_null<UserData*> user) {
|
Dialogs::ShowSearchFromBox(peer, base::lambda_guarded(this, [this, peer](not_null<UserData*> user) {
|
||||||
Ui::hideLayer();
|
Ui::hideLayer();
|
||||||
setSearchInPeer(peer, user);
|
setSearchInPeer(peer, user);
|
||||||
onFilterUpdate(true);
|
onFilterUpdate(true);
|
||||||
|
|
|
@ -59,7 +59,7 @@ class DialogsWidget : public Window::AbstractSectionWidget, public RPCSender {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DialogsWidget(QWidget *parent, gsl::not_null<Window::Controller*> controller);
|
DialogsWidget(QWidget *parent, not_null<Window::Controller*> controller);
|
||||||
|
|
||||||
void updateDragInScroll(bool inScroll);
|
void updateDragInScroll(bool inScroll);
|
||||||
|
|
||||||
|
|
|
@ -241,7 +241,7 @@ bool isLayerShown() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void repaintHistoryItem(gsl::not_null<const HistoryItem*> item) {
|
void repaintHistoryItem(not_null<const HistoryItem*> item) {
|
||||||
if (auto main = App::main()) {
|
if (auto main = App::main()) {
|
||||||
main->ui_repaintHistoryItem(item);
|
main->ui_repaintHistoryItem(item);
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ void hideLayer(bool fast = false);
|
||||||
void hideSettingsAndLayer(bool fast = false);
|
void hideSettingsAndLayer(bool fast = false);
|
||||||
bool isLayerShown();
|
bool isLayerShown();
|
||||||
|
|
||||||
void repaintHistoryItem(gsl::not_null<const HistoryItem*> item);
|
void repaintHistoryItem(not_null<const HistoryItem*> item);
|
||||||
void autoplayMediaInlineAsync(const FullMsgId &msgId);
|
void autoplayMediaInlineAsync(const FullMsgId &msgId);
|
||||||
|
|
||||||
void showPeerProfile(const PeerId &peer);
|
void showPeerProfile(const PeerId &peer);
|
||||||
|
|
|
@ -764,7 +764,7 @@ void Histories::savePinnedToServer() const {
|
||||||
MTP::send(MTPmessages_ReorderPinnedDialogs(MTP_flags(flags), MTP_vector(peers)));
|
MTP::send(MTPmessages_ReorderPinnedDialogs(MTP_flags(flags), MTP_vector(peers)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Histories::selfDestructIn(gsl::not_null<HistoryItem*> item, TimeMs delay) {
|
void Histories::selfDestructIn(not_null<HistoryItem*> item, TimeMs delay) {
|
||||||
_selfDestructItems.push_back(item->fullId());
|
_selfDestructItems.push_back(item->fullId());
|
||||||
if (!_selfDestructTimer.isActive() || _selfDestructTimer.remainingTime() > delay) {
|
if (!_selfDestructTimer.isActive() || _selfDestructTimer.remainingTime() > delay) {
|
||||||
_selfDestructTimer.callOnce(delay);
|
_selfDestructTimer.callOnce(delay);
|
||||||
|
@ -1257,7 +1257,7 @@ HistoryItem *History::addNewItem(HistoryItem *adding, bool newMsg) {
|
||||||
adding->addToOverview(AddToOverviewNew);
|
adding->addToOverview(AddToOverviewNew);
|
||||||
if (adding->from()->id) {
|
if (adding->from()->id) {
|
||||||
if (auto user = adding->from()->asUser()) {
|
if (auto user = adding->from()->asUser()) {
|
||||||
auto getLastAuthors = [this]() -> QList<gsl::not_null<UserData*>>* {
|
auto getLastAuthors = [this]() -> QList<not_null<UserData*>>* {
|
||||||
if (auto chat = peer->asChat()) {
|
if (auto chat = peer->asChat()) {
|
||||||
return &chat->lastAuthors;
|
return &chat->lastAuthors;
|
||||||
} else if (auto channel = peer->asMegagroup()) {
|
} else if (auto channel = peer->asMegagroup()) {
|
||||||
|
@ -1291,7 +1291,7 @@ HistoryItem *History::addNewItem(HistoryItem *adding, bool newMsg) {
|
||||||
if (adding->definesReplyKeyboard()) {
|
if (adding->definesReplyKeyboard()) {
|
||||||
auto markupFlags = adding->replyKeyboardFlags();
|
auto markupFlags = adding->replyKeyboardFlags();
|
||||||
if (!(markupFlags & MTPDreplyKeyboardMarkup::Flag::f_selective) || adding->mentionsMe()) {
|
if (!(markupFlags & MTPDreplyKeyboardMarkup::Flag::f_selective) || adding->mentionsMe()) {
|
||||||
auto getMarkupSenders = [this]() -> OrderedSet<gsl::not_null<PeerData*>>* {
|
auto getMarkupSenders = [this]() -> OrderedSet<not_null<PeerData*>>* {
|
||||||
if (auto chat = peer->asChat()) {
|
if (auto chat = peer->asChat()) {
|
||||||
return &chat->markupSenders;
|
return &chat->markupSenders;
|
||||||
} else if (auto channel = peer->asMegagroup()) {
|
} else if (auto channel = peer->asMegagroup()) {
|
||||||
|
@ -1444,8 +1444,8 @@ void History::addOlderSlice(const QVector<MTPMessage> &slice) {
|
||||||
} else if (loadedAtBottom()) { // add photos to overview and authors to lastAuthors
|
} else if (loadedAtBottom()) { // add photos to overview and authors to lastAuthors
|
||||||
bool channel = isChannel();
|
bool channel = isChannel();
|
||||||
int32 mask = 0;
|
int32 mask = 0;
|
||||||
QList<gsl::not_null<UserData*>> *lastAuthors = nullptr;
|
QList<not_null<UserData*>> *lastAuthors = nullptr;
|
||||||
OrderedSet<gsl::not_null<PeerData*>> *markupSenders = nullptr;
|
OrderedSet<not_null<PeerData*>> *markupSenders = nullptr;
|
||||||
if (peer->isChat()) {
|
if (peer->isChat()) {
|
||||||
lastAuthors = &peer->asChat()->lastAuthors;
|
lastAuthors = &peer->asChat()->lastAuthors;
|
||||||
markupSenders = &peer->asChat()->markupSenders;
|
markupSenders = &peer->asChat()->markupSenders;
|
||||||
|
|
|
@ -31,7 +31,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
void HistoryInit();
|
void HistoryInit();
|
||||||
|
|
||||||
class HistoryItem;
|
class HistoryItem;
|
||||||
using SelectedItemSet = QMap<int, gsl::not_null<HistoryItem*>>;
|
using SelectedItemSet = QMap<int, not_null<HistoryItem*>>;
|
||||||
|
|
||||||
enum NewMessageType {
|
enum NewMessageType {
|
||||||
NewMessageUnread,
|
NewMessageUnread,
|
||||||
|
@ -99,7 +99,7 @@ public:
|
||||||
base::Observable<SendActionAnimationUpdate> &sendActionAnimationUpdated() {
|
base::Observable<SendActionAnimationUpdate> &sendActionAnimationUpdated() {
|
||||||
return _sendActionAnimationUpdated;
|
return _sendActionAnimationUpdated;
|
||||||
}
|
}
|
||||||
void selfDestructIn(gsl::not_null<HistoryItem*> item, TimeMs delay);
|
void selfDestructIn(not_null<HistoryItem*> item, TimeMs delay);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void checkSelfDestructItems();
|
void checkSelfDestructItems();
|
||||||
|
@ -646,7 +646,7 @@ private:
|
||||||
|
|
||||||
class HistoryBlock {
|
class HistoryBlock {
|
||||||
public:
|
public:
|
||||||
HistoryBlock(gsl::not_null<History*> history) : _history(history) {
|
HistoryBlock(not_null<History*> history) : _history(history) {
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryBlock(const HistoryBlock &) = delete;
|
HistoryBlock(const HistoryBlock &) = delete;
|
||||||
|
@ -670,7 +670,7 @@ public:
|
||||||
int height() const {
|
int height() const {
|
||||||
return _height;
|
return _height;
|
||||||
}
|
}
|
||||||
gsl::not_null<History*> history() const {
|
not_null<History*> history() const {
|
||||||
return _history;
|
return _history;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -696,7 +696,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const gsl::not_null<History*> _history;
|
const not_null<History*> _history;
|
||||||
|
|
||||||
int _y = 0;
|
int _y = 0;
|
||||||
int _height = 0;
|
int _height = 0;
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace {
|
||||||
|
|
||||||
class UserCheckbox : public Ui::RippleButton {
|
class UserCheckbox : public Ui::RippleButton {
|
||||||
public:
|
public:
|
||||||
UserCheckbox(QWidget *parent, gsl::not_null<UserData*> user, bool checked);
|
UserCheckbox(QWidget *parent, not_null<UserData*> user, bool checked);
|
||||||
|
|
||||||
bool checked() const {
|
bool checked() const {
|
||||||
return _check->checked();
|
return _check->checked();
|
||||||
|
@ -63,13 +63,13 @@ private:
|
||||||
|
|
||||||
QRect _checkRect;
|
QRect _checkRect;
|
||||||
|
|
||||||
gsl::not_null<UserData*> _user;
|
not_null<UserData*> _user;
|
||||||
QString _statusText;
|
QString _statusText;
|
||||||
bool _statusOnline = false;
|
bool _statusOnline = false;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
UserCheckbox::UserCheckbox(QWidget *parent, gsl::not_null<UserData*> user, bool checked) : Ui::RippleButton(parent, st::defaultBoxCheckbox.ripple)
|
UserCheckbox::UserCheckbox(QWidget *parent, not_null<UserData*> user, bool checked) : Ui::RippleButton(parent, st::defaultBoxCheckbox.ripple)
|
||||||
, _st(st::adminLogFilterUserCheckbox)
|
, _st(st::adminLogFilterUserCheckbox)
|
||||||
, _check(std::make_unique<Ui::CheckView>(st::defaultCheck, checked, [this] { rtlupdate(_checkRect); }))
|
, _check(std::make_unique<Ui::CheckView>(st::defaultCheck, checked, [this] { rtlupdate(_checkRect); }))
|
||||||
, _user(user) {
|
, _user(user) {
|
||||||
|
@ -146,7 +146,7 @@ QPoint UserCheckbox::prepareRippleStartPosition() const {
|
||||||
|
|
||||||
class FilterBox::Inner : public TWidget, private base::Subscriber {
|
class FilterBox::Inner : public TWidget, private base::Subscriber {
|
||||||
public:
|
public:
|
||||||
Inner(QWidget *parent, gsl::not_null<ChannelData*> channel, const std::vector<gsl::not_null<UserData*>> &admins, const FilterValue &filter, base::lambda<void()> changedCallback);
|
Inner(QWidget *parent, not_null<ChannelData*> channel, const std::vector<not_null<UserData*>> &admins, const FilterValue &filter, base::lambda<void()> changedCallback);
|
||||||
|
|
||||||
template <typename Widget>
|
template <typename Widget>
|
||||||
QPointer<Widget> addRow(object_ptr<Widget> widget, int marginTop) {
|
QPointer<Widget> addRow(object_ptr<Widget> widget, int marginTop) {
|
||||||
|
@ -167,19 +167,19 @@ protected:
|
||||||
void resizeEvent(QResizeEvent *e) override;
|
void resizeEvent(QResizeEvent *e) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void createControls(const std::vector<gsl::not_null<UserData*>> &admins, const FilterValue &filter);
|
void createControls(const std::vector<not_null<UserData*>> &admins, const FilterValue &filter);
|
||||||
void createAllActionsCheckbox(const FilterValue &filter);
|
void createAllActionsCheckbox(const FilterValue &filter);
|
||||||
void createActionsCheckboxes(const FilterValue &filter);
|
void createActionsCheckboxes(const FilterValue &filter);
|
||||||
void createAllUsersCheckbox(const FilterValue &filter);
|
void createAllUsersCheckbox(const FilterValue &filter);
|
||||||
void createAdminsCheckboxes(const std::vector<gsl::not_null<UserData*>> &admins, const FilterValue &filter);
|
void createAdminsCheckboxes(const std::vector<not_null<UserData*>> &admins, const FilterValue &filter);
|
||||||
|
|
||||||
gsl::not_null<ChannelData*> _channel;
|
not_null<ChannelData*> _channel;
|
||||||
|
|
||||||
QPointer<Ui::Checkbox> _allFlags;
|
QPointer<Ui::Checkbox> _allFlags;
|
||||||
QMap<MTPDchannelAdminLogEventsFilter::Flags, QPointer<Ui::Checkbox>> _filterFlags;
|
QMap<MTPDchannelAdminLogEventsFilter::Flags, QPointer<Ui::Checkbox>> _filterFlags;
|
||||||
|
|
||||||
QPointer<Ui::Checkbox> _allUsers;
|
QPointer<Ui::Checkbox> _allUsers;
|
||||||
QMap<gsl::not_null<UserData*>, QPointer<UserCheckbox>> _admins;
|
QMap<not_null<UserData*>, QPointer<UserCheckbox>> _admins;
|
||||||
bool _restoringInvariant = false;
|
bool _restoringInvariant = false;
|
||||||
|
|
||||||
struct Row {
|
struct Row {
|
||||||
|
@ -192,13 +192,13 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
FilterBox::Inner::Inner(QWidget *parent, gsl::not_null<ChannelData*> channel, const std::vector<gsl::not_null<UserData*>> &admins, const FilterValue &filter, base::lambda<void()> changedCallback) : TWidget(parent)
|
FilterBox::Inner::Inner(QWidget *parent, not_null<ChannelData*> channel, const std::vector<not_null<UserData*>> &admins, const FilterValue &filter, base::lambda<void()> changedCallback) : TWidget(parent)
|
||||||
, _channel(channel)
|
, _channel(channel)
|
||||||
, _changedCallback(std::move(changedCallback)) {
|
, _changedCallback(std::move(changedCallback)) {
|
||||||
createControls(admins, filter);
|
createControls(admins, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FilterBox::Inner::createControls(const std::vector<gsl::not_null<UserData*>> &admins, const FilterValue &filter) {
|
void FilterBox::Inner::createControls(const std::vector<not_null<UserData*>> &admins, const FilterValue &filter) {
|
||||||
createAllActionsCheckbox(filter);
|
createAllActionsCheckbox(filter);
|
||||||
createActionsCheckboxes(filter);
|
createActionsCheckboxes(filter);
|
||||||
createAllUsersCheckbox(filter);
|
createAllUsersCheckbox(filter);
|
||||||
|
@ -276,7 +276,7 @@ void FilterBox::Inner::createAllUsersCheckbox(const FilterValue &filter) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void FilterBox::Inner::createAdminsCheckboxes(const std::vector<gsl::not_null<UserData*>> &admins, const FilterValue &filter) {
|
void FilterBox::Inner::createAdminsCheckboxes(const std::vector<not_null<UserData*>> &admins, const FilterValue &filter) {
|
||||||
for (auto user : admins) {
|
for (auto user : admins) {
|
||||||
auto checked = filter.allUsers || base::contains(filter.admins, user);
|
auto checked = filter.allUsers || base::contains(filter.admins, user);
|
||||||
auto checkbox = addRow(object_ptr<UserCheckbox>(this, user, checked), st::adminLogFilterLittleSkip);
|
auto checkbox = addRow(object_ptr<UserCheckbox>(this, user, checked), st::adminLogFilterLittleSkip);
|
||||||
|
@ -356,7 +356,7 @@ void FilterBox::Inner::resizeEvent(QResizeEvent *e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FilterBox::FilterBox(QWidget*, gsl::not_null<ChannelData*> channel, const std::vector<gsl::not_null<UserData*>> &admins, const FilterValue &filter, base::lambda<void(FilterValue &&filter)> saveCallback) : BoxContent()
|
FilterBox::FilterBox(QWidget*, not_null<ChannelData*> channel, const std::vector<not_null<UserData*>> &admins, const FilterValue &filter, base::lambda<void(FilterValue &&filter)> saveCallback) : BoxContent()
|
||||||
, _channel(channel)
|
, _channel(channel)
|
||||||
, _admins(admins)
|
, _admins(admins)
|
||||||
, _initialFilter(filter)
|
, _initialFilter(filter)
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace AdminLog {
|
||||||
|
|
||||||
class FilterBox : public BoxContent {
|
class FilterBox : public BoxContent {
|
||||||
public:
|
public:
|
||||||
FilterBox(QWidget*, gsl::not_null<ChannelData*> channel, const std::vector<gsl::not_null<UserData*>> &admins, const FilterValue &filter, base::lambda<void(FilterValue &&filter)> saveCallback);
|
FilterBox(QWidget*, not_null<ChannelData*> channel, const std::vector<not_null<UserData*>> &admins, const FilterValue &filter, base::lambda<void(FilterValue &&filter)> saveCallback);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void prepare() override;
|
void prepare() override;
|
||||||
|
@ -36,8 +36,8 @@ private:
|
||||||
void resizeToContent();
|
void resizeToContent();
|
||||||
void refreshButtons();
|
void refreshButtons();
|
||||||
|
|
||||||
gsl::not_null<ChannelData*> _channel;
|
not_null<ChannelData*> _channel;
|
||||||
std::vector<gsl::not_null<UserData*>> _admins;
|
std::vector<not_null<UserData*>> _admins;
|
||||||
FilterValue _initialFilter;
|
FilterValue _initialFilter;
|
||||||
base::lambda<void(FilterValue &&filter)> _saveCallback;
|
base::lambda<void(FilterValue &&filter)> _saveCallback;
|
||||||
|
|
||||||
|
|
|
@ -205,7 +205,7 @@ void InnerWidget::enumerateDates(Method method) {
|
||||||
enumerateItems<EnumItemsDirection::BottomToTop>(dateCallback);
|
enumerateItems<EnumItemsDirection::BottomToTop>(dateCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
InnerWidget::InnerWidget(QWidget *parent, gsl::not_null<Window::Controller*> controller, gsl::not_null<ChannelData*> channel) : TWidget(parent)
|
InnerWidget::InnerWidget(QWidget *parent, not_null<Window::Controller*> controller, not_null<ChannelData*> channel) : TWidget(parent)
|
||||||
, _controller(controller)
|
, _controller(controller)
|
||||||
, _channel(channel)
|
, _channel(channel)
|
||||||
, _history(App::history(channel))
|
, _history(App::history(channel))
|
||||||
|
@ -213,7 +213,7 @@ InnerWidget::InnerWidget(QWidget *parent, gsl::not_null<Window::Controller*> con
|
||||||
, _emptyText(st::historyAdminLogEmptyWidth - st::historyAdminLogEmptyPadding.left() - st::historyAdminLogEmptyPadding.left()) {
|
, _emptyText(st::historyAdminLogEmptyWidth - st::historyAdminLogEmptyPadding.left() - st::historyAdminLogEmptyPadding.left()) {
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
_scrollDateHideTimer.setCallback([this] { scrollDateHideByTimer(); });
|
_scrollDateHideTimer.setCallback([this] { scrollDateHideByTimer(); });
|
||||||
subscribe(Auth().data().repaintLogEntry(), [this](gsl::not_null<const HistoryItem*> historyItem) {
|
subscribe(Auth().data().repaintLogEntry(), [this](not_null<const HistoryItem*> historyItem) {
|
||||||
if (_history == historyItem->history()) {
|
if (_history == historyItem->history()) {
|
||||||
repaintItem(historyItem);
|
repaintItem(historyItem);
|
||||||
}
|
}
|
||||||
|
@ -421,7 +421,7 @@ QPoint InnerWidget::tooltipPos() const {
|
||||||
return _mousePosition;
|
return _mousePosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InnerWidget::saveState(gsl::not_null<SectionMemento*> memento) {
|
void InnerWidget::saveState(not_null<SectionMemento*> memento) {
|
||||||
memento->setFilter(std::move(_filter));
|
memento->setFilter(std::move(_filter));
|
||||||
memento->setAdmins(std::move(_admins));
|
memento->setAdmins(std::move(_admins));
|
||||||
memento->setAdminsCanEdit(std::move(_adminsCanEdit));
|
memento->setAdminsCanEdit(std::move(_adminsCanEdit));
|
||||||
|
@ -433,7 +433,7 @@ void InnerWidget::saveState(gsl::not_null<SectionMemento*> memento) {
|
||||||
_upLoaded = _downLoaded = true; // Don't load or handle anything anymore.
|
_upLoaded = _downLoaded = true; // Don't load or handle anything anymore.
|
||||||
}
|
}
|
||||||
|
|
||||||
void InnerWidget::restoreState(gsl::not_null<SectionMemento*> memento) {
|
void InnerWidget::restoreState(not_null<SectionMemento*> memento) {
|
||||||
_items = memento->takeItems();
|
_items = memento->takeItems();
|
||||||
_itemsByIds = memento->takeItemsByIds();
|
_itemsByIds = memento->takeItemsByIds();
|
||||||
_idManager = memento->takeIdManager();
|
_idManager = memento->takeIdManager();
|
||||||
|
@ -635,7 +635,7 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
|
||||||
}
|
}
|
||||||
p.translate(0, -top);
|
p.translate(0, -top);
|
||||||
|
|
||||||
enumerateUserpics([&p, &clip](gsl::not_null<HistoryMessage*> message, int userpicTop) {
|
enumerateUserpics([&p, &clip](not_null<HistoryMessage*> message, int userpicTop) {
|
||||||
// stop the enumeration if the userpic is below the painted rect
|
// stop the enumeration if the userpic is below the painted rect
|
||||||
if (userpicTop >= clip.top() + clip.height()) {
|
if (userpicTop >= clip.top() + clip.height()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -650,7 +650,7 @@ void InnerWidget::paintEvent(QPaintEvent *e) {
|
||||||
|
|
||||||
auto dateHeight = st::msgServicePadding.bottom() + st::msgServiceFont->height + st::msgServicePadding.top();
|
auto dateHeight = st::msgServicePadding.bottom() + st::msgServiceFont->height + st::msgServicePadding.top();
|
||||||
auto scrollDateOpacity = _scrollDateOpacity.current(ms, _scrollDateShown ? 1. : 0.);
|
auto scrollDateOpacity = _scrollDateOpacity.current(ms, _scrollDateShown ? 1. : 0.);
|
||||||
enumerateDates([&p, &clip, scrollDateOpacity, dateHeight/*, lastDate, showFloatingBefore*/](gsl::not_null<HistoryItem*> item, int itemtop, int dateTop) {
|
enumerateDates([&p, &clip, scrollDateOpacity, dateHeight/*, lastDate, showFloatingBefore*/](not_null<HistoryItem*> item, int itemtop, int dateTop) {
|
||||||
// stop the enumeration if the date is above the painted rect
|
// stop the enumeration if the date is above the painted rect
|
||||||
if (dateTop + dateHeight <= clip.top()) {
|
if (dateTop + dateHeight <= clip.top()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1008,7 +1008,7 @@ void InnerWidget::setToClipboard(const TextWithEntities &forClipboard, QClipboar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InnerWidget::suggestRestrictUser(gsl::not_null<UserData*> user) {
|
void InnerWidget::suggestRestrictUser(not_null<UserData*> user) {
|
||||||
Expects(_menu != nullptr);
|
Expects(_menu != nullptr);
|
||||||
if (!_channel->isMegagroup() || !_channel->canBanMembers() || _admins.empty()) {
|
if (!_channel->isMegagroup() || !_channel->canBanMembers() || _admins.empty()) {
|
||||||
return;
|
return;
|
||||||
|
@ -1054,7 +1054,7 @@ void InnerWidget::suggestRestrictUser(gsl::not_null<UserData*> user) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void InnerWidget::restrictUser(gsl::not_null<UserData*> user, const MTPChannelBannedRights &oldRights, const MTPChannelBannedRights &newRights) {
|
void InnerWidget::restrictUser(not_null<UserData*> user, const MTPChannelBannedRights &oldRights, const MTPChannelBannedRights &newRights) {
|
||||||
auto weak = QPointer<InnerWidget>(this);
|
auto weak = QPointer<InnerWidget>(this);
|
||||||
MTP::send(MTPchannels_EditBanned(_channel->inputChannel, user->inputUser, newRights), rpcDone([megagroup = _channel.get(), user, weak, oldRights, newRights](const MTPUpdates &result) {
|
MTP::send(MTPchannels_EditBanned(_channel->inputChannel, user->inputUser, newRights), rpcDone([megagroup = _channel.get(), user, weak, oldRights, newRights](const MTPUpdates &result) {
|
||||||
Auth().api().applyUpdates(result);
|
Auth().api().applyUpdates(result);
|
||||||
|
@ -1065,7 +1065,7 @@ void InnerWidget::restrictUser(gsl::not_null<UserData*> user, const MTPChannelBa
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void InnerWidget::restrictUserDone(gsl::not_null<UserData*> user, const MTPChannelBannedRights &rights) {
|
void InnerWidget::restrictUserDone(not_null<UserData*> user, const MTPChannelBannedRights &rights) {
|
||||||
Expects(rights.type() == mtpc_channelBannedRights);
|
Expects(rights.type() == mtpc_channelBannedRights);
|
||||||
if (rights.c_channelBannedRights().vflags.v) {
|
if (rights.c_channelBannedRights().vflags.v) {
|
||||||
_admins.erase(std::remove(_admins.begin(), _admins.end(), user), _admins.end());
|
_admins.erase(std::remove(_admins.begin(), _admins.end(), user), _admins.end());
|
||||||
|
@ -1290,7 +1290,7 @@ void InnerWidget::updateSelected() {
|
||||||
if (!dragState.link && itemPoint.x() >= st::historyPhotoLeft && itemPoint.x() < st::historyPhotoLeft + st::msgPhotoSize) {
|
if (!dragState.link && itemPoint.x() >= st::historyPhotoLeft && itemPoint.x() < st::historyPhotoLeft + st::msgPhotoSize) {
|
||||||
if (auto message = item->toHistoryMessage()) {
|
if (auto message = item->toHistoryMessage()) {
|
||||||
if (message->hasFromPhoto()) {
|
if (message->hasFromPhoto()) {
|
||||||
enumerateUserpics([&dragState, &lnkhost, &point](gsl::not_null<HistoryMessage*> message, int userpicTop) -> bool {
|
enumerateUserpics([&dragState, &lnkhost, &point](not_null<HistoryMessage*> message, int userpicTop) -> bool {
|
||||||
// stop enumeration if the userpic is below our point
|
// stop enumeration if the userpic is below our point
|
||||||
if (userpicTop > point.y()) {
|
if (userpicTop > point.y()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1468,7 +1468,7 @@ void InnerWidget::performDrag() {
|
||||||
//} // TODO
|
//} // TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
int InnerWidget::itemTop(gsl::not_null<const HistoryItem*> item) const {
|
int InnerWidget::itemTop(not_null<const HistoryItem*> item) const {
|
||||||
return _itemsTop + item->y();
|
return _itemsTop + item->y();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,13 +40,13 @@ class SectionMemento;
|
||||||
|
|
||||||
class InnerWidget final : public TWidget, public Ui::AbstractTooltipShower, private MTP::Sender, private base::Subscriber {
|
class InnerWidget final : public TWidget, public Ui::AbstractTooltipShower, private MTP::Sender, private base::Subscriber {
|
||||||
public:
|
public:
|
||||||
InnerWidget(QWidget *parent, gsl::not_null<Window::Controller*> controller, gsl::not_null<ChannelData*> channel);
|
InnerWidget(QWidget *parent, not_null<Window::Controller*> controller, not_null<ChannelData*> channel);
|
||||||
|
|
||||||
base::Observable<void> showSearchSignal;
|
base::Observable<void> showSearchSignal;
|
||||||
base::Observable<int> scrollToSignal;
|
base::Observable<int> scrollToSignal;
|
||||||
base::Observable<void> cancelledSignal;
|
base::Observable<void> cancelledSignal;
|
||||||
|
|
||||||
gsl::not_null<ChannelData*> channel() const {
|
not_null<ChannelData*> channel() const {
|
||||||
return _channel;
|
return _channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,8 +61,8 @@ public:
|
||||||
return TWidget::resizeToWidth(newWidth);
|
return TWidget::resizeToWidth(newWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveState(gsl::not_null<SectionMemento*> memento);
|
void saveState(not_null<SectionMemento*> memento);
|
||||||
void restoreState(gsl::not_null<SectionMemento*> memento);
|
void restoreState(not_null<SectionMemento*> memento);
|
||||||
|
|
||||||
// Empty "flags" means all events.
|
// Empty "flags" means all events.
|
||||||
void applyFilter(FilterValue &&value);
|
void applyFilter(FilterValue &&value);
|
||||||
|
@ -111,7 +111,7 @@ private:
|
||||||
void mouseActionCancel();
|
void mouseActionCancel();
|
||||||
void updateSelected();
|
void updateSelected();
|
||||||
void performDrag();
|
void performDrag();
|
||||||
int itemTop(gsl::not_null<const HistoryItem*> item) const;
|
int itemTop(not_null<const HistoryItem*> item) const;
|
||||||
void repaintItem(const HistoryItem *item);
|
void repaintItem(const HistoryItem *item);
|
||||||
QPoint mapPointToItem(QPoint point, const HistoryItem *item) const;
|
QPoint mapPointToItem(QPoint point, const HistoryItem *item) const;
|
||||||
void handlePendingHistoryResize();
|
void handlePendingHistoryResize();
|
||||||
|
@ -129,9 +129,9 @@ private:
|
||||||
void copySelectedText();
|
void copySelectedText();
|
||||||
TextWithEntities getSelectedText() const;
|
TextWithEntities getSelectedText() const;
|
||||||
void setToClipboard(const TextWithEntities &forClipboard, QClipboard::Mode mode = QClipboard::Clipboard);
|
void setToClipboard(const TextWithEntities &forClipboard, QClipboard::Mode mode = QClipboard::Clipboard);
|
||||||
void suggestRestrictUser(gsl::not_null<UserData*> user);
|
void suggestRestrictUser(not_null<UserData*> user);
|
||||||
void restrictUser(gsl::not_null<UserData*> user, const MTPChannelBannedRights &oldRights, const MTPChannelBannedRights &newRights);
|
void restrictUser(not_null<UserData*> user, const MTPChannelBannedRights &oldRights, const MTPChannelBannedRights &newRights);
|
||||||
void restrictUserDone(gsl::not_null<UserData*> user, const MTPChannelBannedRights &rights);
|
void restrictUserDone(not_null<UserData*> user, const MTPChannelBannedRights &rights);
|
||||||
|
|
||||||
void requestAdmins();
|
void requestAdmins();
|
||||||
void checkPreloadMore();
|
void checkPreloadMore();
|
||||||
|
@ -164,7 +164,7 @@ private:
|
||||||
// This function finds all userpics on the left that are displayed and calls template method
|
// This function finds all userpics on the left that are displayed and calls template method
|
||||||
// for each found userpic (from the top to the bottom) using enumerateItems() method.
|
// for each found userpic (from the top to the bottom) using enumerateItems() method.
|
||||||
//
|
//
|
||||||
// Method has "bool (*Method)(gsl::not_null<HistoryMessage*> message, int userpicTop)" signature
|
// Method has "bool (*Method)(not_null<HistoryMessage*> message, int userpicTop)" signature
|
||||||
// if it returns false the enumeration stops immidiately.
|
// if it returns false the enumeration stops immidiately.
|
||||||
template <typename Method>
|
template <typename Method>
|
||||||
void enumerateUserpics(Method method);
|
void enumerateUserpics(Method method);
|
||||||
|
@ -172,14 +172,14 @@ private:
|
||||||
// This function finds all date elements that are displayed and calls template method
|
// This function finds all date elements that are displayed and calls template method
|
||||||
// for each found date element (from the bottom to the top) using enumerateItems() method.
|
// for each found date element (from the bottom to the top) using enumerateItems() method.
|
||||||
//
|
//
|
||||||
// Method has "bool (*Method)(gsl::not_null<HistoryItem*> item, int itemtop, int dateTop)" signature
|
// Method has "bool (*Method)(not_null<HistoryItem*> item, int itemtop, int dateTop)" signature
|
||||||
// if it returns false the enumeration stops immidiately.
|
// if it returns false the enumeration stops immidiately.
|
||||||
template <typename Method>
|
template <typename Method>
|
||||||
void enumerateDates(Method method);
|
void enumerateDates(Method method);
|
||||||
|
|
||||||
gsl::not_null<Window::Controller*> _controller;
|
not_null<Window::Controller*> _controller;
|
||||||
gsl::not_null<ChannelData*> _channel;
|
not_null<ChannelData*> _channel;
|
||||||
gsl::not_null<History*> _history;
|
not_null<History*> _history;
|
||||||
std::vector<HistoryItemOwned> _items;
|
std::vector<HistoryItemOwned> _items;
|
||||||
std::map<uint64, HistoryItem*> _itemsByIds;
|
std::map<uint64, HistoryItem*> _itemsByIds;
|
||||||
int _itemsTop = 0;
|
int _itemsTop = 0;
|
||||||
|
@ -235,8 +235,8 @@ private:
|
||||||
|
|
||||||
FilterValue _filter;
|
FilterValue _filter;
|
||||||
QString _searchQuery;
|
QString _searchQuery;
|
||||||
std::vector<gsl::not_null<UserData*>> _admins;
|
std::vector<not_null<UserData*>> _admins;
|
||||||
std::vector<gsl::not_null<UserData*>> _adminsCanEdit;
|
std::vector<not_null<UserData*>> _adminsCanEdit;
|
||||||
base::lambda<void(FilterValue &&filter)> _showFilterCallback;
|
base::lambda<void(FilterValue &&filter)> _showFilterCallback;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -113,7 +113,7 @@ const auto CollectChanges = [](auto &phraseMap, auto plusFlags, auto minusFlags)
|
||||||
return withPrefix(plusFlags & ~minusFlags, '+') + withPrefix(minusFlags & ~plusFlags, kMinus);
|
return withPrefix(plusFlags & ~minusFlags, '+') + withPrefix(minusFlags & ~plusFlags, kMinus);
|
||||||
};
|
};
|
||||||
|
|
||||||
auto GenerateAdminChangeText(gsl::not_null<ChannelData*> channel, const TextWithEntities &user, const MTPChannelAdminRights *newRights, const MTPChannelAdminRights *prevRights) {
|
auto GenerateAdminChangeText(not_null<ChannelData*> channel, const TextWithEntities &user, const MTPChannelAdminRights *newRights, const MTPChannelAdminRights *prevRights) {
|
||||||
using Flag = MTPDchannelAdminRights::Flag;
|
using Flag = MTPDchannelAdminRights::Flag;
|
||||||
using Flags = MTPDchannelAdminRights::Flags;
|
using Flags = MTPDchannelAdminRights::Flags;
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ auto GenerateUserString(MTPint userId) {
|
||||||
return lng_admin_log_user_with_username__generic(lt_name, name, lt_mention, mention);
|
return lng_admin_log_user_with_username__generic(lt_name, name, lt_mention, mention);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto GenerateParticipantChangeTextInner(gsl::not_null<ChannelData*> channel, const MTPChannelParticipant &participant, const MTPChannelParticipant *oldParticipant) {
|
auto GenerateParticipantChangeTextInner(not_null<ChannelData*> channel, const MTPChannelParticipant &participant, const MTPChannelParticipant *oldParticipant) {
|
||||||
auto oldType = oldParticipant ? oldParticipant->type() : 0;
|
auto oldType = oldParticipant ? oldParticipant->type() : 0;
|
||||||
|
|
||||||
auto resultForParticipant = [channel, oldParticipant, oldType](auto &&data) {
|
auto resultForParticipant = [channel, oldParticipant, oldType](auto &&data) {
|
||||||
|
@ -236,7 +236,7 @@ auto GenerateParticipantChangeTextInner(gsl::not_null<ChannelData*> channel, con
|
||||||
Unexpected("Participant type in GenerateParticipantChangeTextInner()");
|
Unexpected("Participant type in GenerateParticipantChangeTextInner()");
|
||||||
}
|
}
|
||||||
|
|
||||||
TextWithEntities GenerateParticipantChangeText(gsl::not_null<ChannelData*> channel, const MTPChannelParticipant &participant, const MTPChannelParticipant *oldParticipant = nullptr) {
|
TextWithEntities GenerateParticipantChangeText(not_null<ChannelData*> channel, const MTPChannelParticipant &participant, const MTPChannelParticipant *oldParticipant = nullptr) {
|
||||||
auto result = GenerateParticipantChangeTextInner(channel, participant, oldParticipant);
|
auto result = GenerateParticipantChangeTextInner(channel, participant, oldParticipant);
|
||||||
result.entities.push_front(EntityInText(EntityInTextItalic, 0, result.text.size()));
|
result.entities.push_front(EntityInText(EntityInTextItalic, 0, result.text.size()));
|
||||||
return result;
|
return result;
|
||||||
|
@ -244,7 +244,7 @@ TextWithEntities GenerateParticipantChangeText(gsl::not_null<ChannelData*> chann
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void GenerateItems(gsl::not_null<History*> history, LocalIdManager &idManager, const MTPDchannelAdminLogEvent &event, base::lambda<void(HistoryItemOwned item)> callback) {
|
void GenerateItems(not_null<History*> history, LocalIdManager &idManager, const MTPDchannelAdminLogEvent &event, base::lambda<void(HistoryItemOwned item)> callback) {
|
||||||
Expects(history->peer->isChannel());
|
Expects(history->peer->isChannel());
|
||||||
|
|
||||||
auto id = event.vid.v;
|
auto id = event.vid.v;
|
||||||
|
@ -252,7 +252,7 @@ void GenerateItems(gsl::not_null<History*> history, LocalIdManager &idManager, c
|
||||||
auto channel = history->peer->asChannel();
|
auto channel = history->peer->asChannel();
|
||||||
auto &action = event.vaction;
|
auto &action = event.vaction;
|
||||||
auto date = event.vdate;
|
auto date = event.vdate;
|
||||||
auto addPart = [&callback](gsl::not_null<HistoryItem*> item) {
|
auto addPart = [&callback](not_null<HistoryItem*> item) {
|
||||||
return callback(HistoryItemOwned(item));
|
return callback(HistoryItemOwned(item));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -25,12 +25,12 @@ namespace AdminLog {
|
||||||
class HistoryItemOwned;
|
class HistoryItemOwned;
|
||||||
class LocalIdManager;
|
class LocalIdManager;
|
||||||
|
|
||||||
void GenerateItems(gsl::not_null<History*> history, LocalIdManager &idManager, const MTPDchannelAdminLogEvent &event, base::lambda<void(HistoryItemOwned item)> callback);
|
void GenerateItems(not_null<History*> history, LocalIdManager &idManager, const MTPDchannelAdminLogEvent &event, base::lambda<void(HistoryItemOwned item)> callback);
|
||||||
|
|
||||||
// Smart pointer wrapper for HistoryItem* that destroys the owned item.
|
// Smart pointer wrapper for HistoryItem* that destroys the owned item.
|
||||||
class HistoryItemOwned {
|
class HistoryItemOwned {
|
||||||
public:
|
public:
|
||||||
explicit HistoryItemOwned(gsl::not_null<HistoryItem*> data) : _data(data) {
|
explicit HistoryItemOwned(not_null<HistoryItem*> data) : _data(data) {
|
||||||
}
|
}
|
||||||
HistoryItemOwned(const HistoryItemOwned &other) = delete;
|
HistoryItemOwned(const HistoryItemOwned &other) = delete;
|
||||||
HistoryItemOwned &operator=(const HistoryItemOwned &other) = delete;
|
HistoryItemOwned &operator=(const HistoryItemOwned &other) = delete;
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace AdminLog {
|
||||||
|
|
||||||
class FixedBar final : public TWidget, private base::Subscriber {
|
class FixedBar final : public TWidget, private base::Subscriber {
|
||||||
public:
|
public:
|
||||||
FixedBar(QWidget *parent, gsl::not_null<ChannelData*> channel);
|
FixedBar(QWidget *parent, not_null<ChannelData*> channel);
|
||||||
|
|
||||||
base::Observable<void> showFilterSignal;
|
base::Observable<void> showFilterSignal;
|
||||||
base::Observable<void> searchCancelledSignal;
|
base::Observable<void> searchCancelledSignal;
|
||||||
|
@ -74,7 +74,7 @@ private:
|
||||||
void applySearch();
|
void applySearch();
|
||||||
void searchAnimationCallback();
|
void searchAnimationCallback();
|
||||||
|
|
||||||
gsl::not_null<ChannelData*> _channel;
|
not_null<ChannelData*> _channel;
|
||||||
object_ptr<Ui::FlatInput> _field;
|
object_ptr<Ui::FlatInput> _field;
|
||||||
object_ptr<Profile::BackButton> _backButton;
|
object_ptr<Profile::BackButton> _backButton;
|
||||||
object_ptr<Ui::IconButton> _search;
|
object_ptr<Ui::IconButton> _search;
|
||||||
|
@ -88,13 +88,13 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
object_ptr<Window::SectionWidget> SectionMemento::createWidget(QWidget *parent, gsl::not_null<Window::Controller*> controller, const QRect &geometry) {
|
object_ptr<Window::SectionWidget> SectionMemento::createWidget(QWidget *parent, not_null<Window::Controller*> controller, const QRect &geometry) {
|
||||||
auto result = object_ptr<Widget>(parent, controller, _channel);
|
auto result = object_ptr<Widget>(parent, controller, _channel);
|
||||||
result->setInternalState(geometry, this);
|
result->setInternalState(geometry, this);
|
||||||
return std::move(result);
|
return std::move(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
FixedBar::FixedBar(QWidget *parent, gsl::not_null<ChannelData*> channel) : TWidget(parent)
|
FixedBar::FixedBar(QWidget *parent, not_null<ChannelData*> channel) : TWidget(parent)
|
||||||
, _channel(channel)
|
, _channel(channel)
|
||||||
, _field(this, st::historyAdminLogSearchField, langFactory(lng_dlg_filter))
|
, _field(this, st::historyAdminLogSearchField, langFactory(lng_dlg_filter))
|
||||||
, _backButton(this, lang(lng_admin_log_title_all))
|
, _backButton(this, lang(lng_admin_log_title_all))
|
||||||
|
@ -232,7 +232,7 @@ void FixedBar::mousePressEvent(QMouseEvent *e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget::Widget(QWidget *parent, gsl::not_null<Window::Controller*> controller, gsl::not_null<ChannelData*> channel) : Window::SectionWidget(parent, controller)
|
Widget::Widget(QWidget *parent, not_null<Window::Controller*> controller, not_null<ChannelData*> channel) : Window::SectionWidget(parent, controller)
|
||||||
, _scroll(this, st::historyScroll, false)
|
, _scroll(this, st::historyScroll, false)
|
||||||
, _fixedBar(this, channel)
|
, _fixedBar(this, channel)
|
||||||
, _fixedBarShadow(this, st::shadowFg)
|
, _fixedBarShadow(this, st::shadowFg)
|
||||||
|
@ -271,7 +271,7 @@ void Widget::updateAdaptiveLayout() {
|
||||||
_fixedBarShadow->moveToLeft(Adaptive::OneColumn() ? 0 : st::lineWidth, _fixedBar->height());
|
_fixedBarShadow->moveToLeft(Adaptive::OneColumn() ? 0 : st::lineWidth, _fixedBar->height());
|
||||||
}
|
}
|
||||||
|
|
||||||
gsl::not_null<ChannelData*> Widget::channel() const {
|
not_null<ChannelData*> Widget::channel() const {
|
||||||
return _inner->channel();
|
return _inner->channel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,7 +288,7 @@ void Widget::doSetInnerFocus() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Widget::showInternal(gsl::not_null<Window::SectionMemento*> memento) {
|
bool Widget::showInternal(not_null<Window::SectionMemento*> memento) {
|
||||||
if (auto logMemento = dynamic_cast<SectionMemento*>(memento.get())) {
|
if (auto logMemento = dynamic_cast<SectionMemento*>(memento.get())) {
|
||||||
if (logMemento->getChannel() == channel()) {
|
if (logMemento->getChannel() == channel()) {
|
||||||
restoreState(logMemento);
|
restoreState(logMemento);
|
||||||
|
@ -298,7 +298,7 @@ bool Widget::showInternal(gsl::not_null<Window::SectionMemento*> memento) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::setInternalState(const QRect &geometry, gsl::not_null<SectionMemento*> memento) {
|
void Widget::setInternalState(const QRect &geometry, not_null<SectionMemento*> memento) {
|
||||||
setGeometry(geometry);
|
setGeometry(geometry);
|
||||||
myEnsureResized(this);
|
myEnsureResized(this);
|
||||||
restoreState(memento);
|
restoreState(memento);
|
||||||
|
@ -318,12 +318,12 @@ std::unique_ptr<Window::SectionMemento> Widget::createMemento() {
|
||||||
return std::move(result);
|
return std::move(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::saveState(gsl::not_null<SectionMemento*> memento) {
|
void Widget::saveState(not_null<SectionMemento*> memento) {
|
||||||
memento->setScrollTop(_scroll->scrollTop());
|
memento->setScrollTop(_scroll->scrollTop());
|
||||||
_inner->saveState(memento);
|
_inner->saveState(memento);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::restoreState(gsl::not_null<SectionMemento*> memento) {
|
void Widget::restoreState(not_null<SectionMemento*> memento) {
|
||||||
_inner->restoreState(memento);
|
_inner->restoreState(memento);
|
||||||
auto scrollTop = memento->getScrollTop();
|
auto scrollTop = memento->getScrollTop();
|
||||||
_scroll->scrollToY(scrollTop);
|
_scroll->scrollToY(scrollTop);
|
||||||
|
|
|
@ -48,7 +48,7 @@ class SectionMemento;
|
||||||
struct FilterValue {
|
struct FilterValue {
|
||||||
// Empty "flags" means all events.
|
// Empty "flags" means all events.
|
||||||
MTPDchannelAdminLogEventsFilter::Flags flags = 0;
|
MTPDchannelAdminLogEventsFilter::Flags flags = 0;
|
||||||
std::vector<gsl::not_null<UserData*>> admins;
|
std::vector<not_null<UserData*>> admins;
|
||||||
bool allUsers = true;
|
bool allUsers = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -82,9 +82,9 @@ private:
|
||||||
|
|
||||||
class Widget final : public Window::SectionWidget {
|
class Widget final : public Window::SectionWidget {
|
||||||
public:
|
public:
|
||||||
Widget(QWidget *parent, gsl::not_null<Window::Controller*> controller, gsl::not_null<ChannelData*> channel);
|
Widget(QWidget *parent, not_null<Window::Controller*> controller, not_null<ChannelData*> channel);
|
||||||
|
|
||||||
gsl::not_null<ChannelData*> channel() const;
|
not_null<ChannelData*> channel() const;
|
||||||
PeerData *peerForDialogs() const override {
|
PeerData *peerForDialogs() const override {
|
||||||
return channel();
|
return channel();
|
||||||
}
|
}
|
||||||
|
@ -95,10 +95,10 @@ public:
|
||||||
|
|
||||||
QPixmap grabForShowAnimation(const Window::SectionSlideParams ¶ms) override;
|
QPixmap grabForShowAnimation(const Window::SectionSlideParams ¶ms) override;
|
||||||
|
|
||||||
bool showInternal(gsl::not_null<Window::SectionMemento*> memento) override;
|
bool showInternal(not_null<Window::SectionMemento*> memento) override;
|
||||||
std::unique_ptr<Window::SectionMemento> createMemento() override;
|
std::unique_ptr<Window::SectionMemento> createMemento() override;
|
||||||
|
|
||||||
void setInternalState(const QRect &geometry, gsl::not_null<SectionMemento*> memento);
|
void setInternalState(const QRect &geometry, not_null<SectionMemento*> memento);
|
||||||
|
|
||||||
// Float player interface.
|
// Float player interface.
|
||||||
bool wheelEventFromFloatPlayer(QEvent *e, Window::Column myColumn, Window::Column playerColumn) override;
|
bool wheelEventFromFloatPlayer(QEvent *e, Window::Column myColumn, Window::Column playerColumn) override;
|
||||||
|
@ -120,8 +120,8 @@ private:
|
||||||
void showFilter();
|
void showFilter();
|
||||||
void onScroll();
|
void onScroll();
|
||||||
void updateAdaptiveLayout();
|
void updateAdaptiveLayout();
|
||||||
void saveState(gsl::not_null<SectionMemento*> memento);
|
void saveState(not_null<SectionMemento*> memento);
|
||||||
void restoreState(gsl::not_null<SectionMemento*> memento);
|
void restoreState(not_null<SectionMemento*> memento);
|
||||||
|
|
||||||
object_ptr<Ui::ScrollArea> _scroll;
|
object_ptr<Ui::ScrollArea> _scroll;
|
||||||
QPointer<InnerWidget> _inner;
|
QPointer<InnerWidget> _inner;
|
||||||
|
@ -133,12 +133,12 @@ private:
|
||||||
|
|
||||||
class SectionMemento : public Window::SectionMemento {
|
class SectionMemento : public Window::SectionMemento {
|
||||||
public:
|
public:
|
||||||
SectionMemento(gsl::not_null<ChannelData*> channel) : _channel(channel) {
|
SectionMemento(not_null<ChannelData*> channel) : _channel(channel) {
|
||||||
}
|
}
|
||||||
|
|
||||||
object_ptr<Window::SectionWidget> createWidget(QWidget *parent, gsl::not_null<Window::Controller*> controller, const QRect &geometry) override;
|
object_ptr<Window::SectionWidget> createWidget(QWidget *parent, not_null<Window::Controller*> controller, const QRect &geometry) override;
|
||||||
|
|
||||||
gsl::not_null<ChannelData*> getChannel() const {
|
not_null<ChannelData*> getChannel() const {
|
||||||
return _channel;
|
return _channel;
|
||||||
}
|
}
|
||||||
void setScrollTop(int scrollTop) {
|
void setScrollTop(int scrollTop) {
|
||||||
|
@ -148,16 +148,16 @@ public:
|
||||||
return _scrollTop;
|
return _scrollTop;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setAdmins(std::vector<gsl::not_null<UserData*>> admins) {
|
void setAdmins(std::vector<not_null<UserData*>> admins) {
|
||||||
_admins = std::move(admins);
|
_admins = std::move(admins);
|
||||||
}
|
}
|
||||||
void setAdminsCanEdit(std::vector<gsl::not_null<UserData*>> admins) {
|
void setAdminsCanEdit(std::vector<not_null<UserData*>> admins) {
|
||||||
_adminsCanEdit = std::move(admins);
|
_adminsCanEdit = std::move(admins);
|
||||||
}
|
}
|
||||||
std::vector<gsl::not_null<UserData*>> takeAdmins() {
|
std::vector<not_null<UserData*>> takeAdmins() {
|
||||||
return std::move(_admins);
|
return std::move(_admins);
|
||||||
}
|
}
|
||||||
std::vector<gsl::not_null<UserData*>> takeAdminsCanEdit() {
|
std::vector<not_null<UserData*>> takeAdminsCanEdit() {
|
||||||
return std::move(_adminsCanEdit);
|
return std::move(_adminsCanEdit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,10 +199,10 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
gsl::not_null<ChannelData*> _channel;
|
not_null<ChannelData*> _channel;
|
||||||
int _scrollTop = 0;
|
int _scrollTop = 0;
|
||||||
std::vector<gsl::not_null<UserData*>> _admins;
|
std::vector<not_null<UserData*>> _admins;
|
||||||
std::vector<gsl::not_null<UserData*>> _adminsCanEdit;
|
std::vector<not_null<UserData*>> _adminsCanEdit;
|
||||||
std::vector<HistoryItemOwned> _items;
|
std::vector<HistoryItemOwned> _items;
|
||||||
std::map<uint64, HistoryItem*> _itemsByIds;
|
std::map<uint64, HistoryItem*> _itemsByIds;
|
||||||
bool _upLoaded = false;
|
bool _upLoaded = false;
|
||||||
|
|
|
@ -84,7 +84,7 @@ int BinarySearchBlocksOrItems(const T &list, int edge) {
|
||||||
|
|
||||||
// flick scroll taken from http://qt-project.org/doc/qt-4.8/demos-embedded-anomaly-src-flickcharm-cpp.html
|
// flick scroll taken from http://qt-project.org/doc/qt-4.8/demos-embedded-anomaly-src-flickcharm-cpp.html
|
||||||
|
|
||||||
HistoryInner::HistoryInner(HistoryWidget *historyWidget, gsl::not_null<Window::Controller*> controller, Ui::ScrollArea *scroll, History *history) : TWidget(nullptr)
|
HistoryInner::HistoryInner(HistoryWidget *historyWidget, not_null<Window::Controller*> controller, Ui::ScrollArea *scroll, History *history) : TWidget(nullptr)
|
||||||
, _controller(controller)
|
, _controller(controller)
|
||||||
, _peer(history->peer)
|
, _peer(history->peer)
|
||||||
, _migrated(history->peer->migrateFrom() ? App::history(history->peer->migrateFrom()->id) : nullptr)
|
, _migrated(history->peer->migrateFrom() ? App::history(history->peer->migrateFrom()->id) : nullptr)
|
||||||
|
@ -116,7 +116,7 @@ HistoryInner::HistoryInner(HistoryWidget *historyWidget, gsl::not_null<Window::C
|
||||||
subscribe(_controller->window()->dragFinished(), [this] {
|
subscribe(_controller->window()->dragFinished(), [this] {
|
||||||
mouseActionUpdate(QCursor::pos());
|
mouseActionUpdate(QCursor::pos());
|
||||||
});
|
});
|
||||||
subscribe(Auth().data().historyCleared(), [this](gsl::not_null<History*> history) {
|
subscribe(Auth().data().historyCleared(), [this](not_null<History*> history) {
|
||||||
if (_history == history) {
|
if (_history == history) {
|
||||||
mouseActionCancel();
|
mouseActionCancel();
|
||||||
}
|
}
|
||||||
|
@ -256,7 +256,7 @@ void HistoryInner::enumerateUserpics(Method method) {
|
||||||
// -1 means we didn't find an attached to next message yet.
|
// -1 means we didn't find an attached to next message yet.
|
||||||
int lowestAttachedItemTop = -1;
|
int lowestAttachedItemTop = -1;
|
||||||
|
|
||||||
auto userpicCallback = [this, &lowestAttachedItemTop, &method](gsl::not_null<HistoryItem*> item, int itemtop, int itembottom) {
|
auto userpicCallback = [this, &lowestAttachedItemTop, &method](not_null<HistoryItem*> item, int itemtop, int itembottom) {
|
||||||
// Skip all service messages.
|
// Skip all service messages.
|
||||||
auto message = item->toHistoryMessage();
|
auto message = item->toHistoryMessage();
|
||||||
if (!message) return true;
|
if (!message) return true;
|
||||||
|
@ -304,7 +304,7 @@ void HistoryInner::enumerateDates(Method method) {
|
||||||
// -1 means we didn't find a same-day with previous message yet.
|
// -1 means we didn't find a same-day with previous message yet.
|
||||||
auto lowestInOneDayItemBottom = -1;
|
auto lowestInOneDayItemBottom = -1;
|
||||||
|
|
||||||
auto dateCallback = [this, &lowestInOneDayItemBottom, &method, drawtop](gsl::not_null<HistoryItem*> item, int itemtop, int itembottom) {
|
auto dateCallback = [this, &lowestInOneDayItemBottom, &method, drawtop](not_null<HistoryItem*> item, int itemtop, int itembottom) {
|
||||||
if (lowestInOneDayItemBottom < 0 && item->isInOneDayWithPrevious()) {
|
if (lowestInOneDayItemBottom < 0 && item->isInOneDayWithPrevious()) {
|
||||||
lowestInOneDayItemBottom = itembottom - item->marginBottom();
|
lowestInOneDayItemBottom = itembottom - item->marginBottom();
|
||||||
}
|
}
|
||||||
|
@ -506,7 +506,7 @@ void HistoryInner::paintEvent(QPaintEvent *e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mtop >= 0 || htop >= 0) {
|
if (mtop >= 0 || htop >= 0) {
|
||||||
enumerateUserpics([&p, &clip](gsl::not_null<HistoryMessage*> message, int userpicTop) {
|
enumerateUserpics([&p, &clip](not_null<HistoryMessage*> message, int userpicTop) {
|
||||||
// stop the enumeration if the userpic is below the painted rect
|
// stop the enumeration if the userpic is below the painted rect
|
||||||
if (userpicTop >= clip.top() + clip.height()) {
|
if (userpicTop >= clip.top() + clip.height()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -529,7 +529,7 @@ void HistoryInner::paintEvent(QPaintEvent *e) {
|
||||||
//int showFloatingBefore = height() - 2 * (_visibleAreaBottom - _visibleAreaTop) - dateHeight;
|
//int showFloatingBefore = height() - 2 * (_visibleAreaBottom - _visibleAreaTop) - dateHeight;
|
||||||
|
|
||||||
auto scrollDateOpacity = _scrollDateOpacity.current(ms, _scrollDateShown ? 1. : 0.);
|
auto scrollDateOpacity = _scrollDateOpacity.current(ms, _scrollDateShown ? 1. : 0.);
|
||||||
enumerateDates([&p, &clip, scrollDateOpacity, dateHeight/*, lastDate, showFloatingBefore*/](gsl::not_null<HistoryItem*> item, int itemtop, int dateTop) {
|
enumerateDates([&p, &clip, scrollDateOpacity, dateHeight/*, lastDate, showFloatingBefore*/](not_null<HistoryItem*> item, int itemtop, int dateTop) {
|
||||||
// stop the enumeration if the date is above the painted rect
|
// stop the enumeration if the date is above the painted rect
|
||||||
if (dateTop + dateHeight <= clip.top()) {
|
if (dateTop + dateHeight <= clip.top()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -2053,7 +2053,7 @@ void HistoryInner::onUpdateSelected() {
|
||||||
|
|
||||||
auto dateHeight = st::msgServicePadding.bottom() + st::msgServiceFont->height + st::msgServicePadding.top();
|
auto dateHeight = st::msgServicePadding.bottom() + st::msgServiceFont->height + st::msgServicePadding.top();
|
||||||
auto scrollDateOpacity = _scrollDateOpacity.current(_scrollDateShown ? 1. : 0.);
|
auto scrollDateOpacity = _scrollDateOpacity.current(_scrollDateShown ? 1. : 0.);
|
||||||
enumerateDates([this, &dragState, &lnkhost, &point, scrollDateOpacity, dateHeight/*, lastDate, showFloatingBefore*/](gsl::not_null<HistoryItem*> item, int itemtop, int dateTop) {
|
enumerateDates([this, &dragState, &lnkhost, &point, scrollDateOpacity, dateHeight/*, lastDate, showFloatingBefore*/](not_null<HistoryItem*> item, int itemtop, int dateTop) {
|
||||||
// stop enumeration if the date is above our point
|
// stop enumeration if the date is above our point
|
||||||
if (dateTop + dateHeight <= point.y()) {
|
if (dateTop + dateHeight <= point.y()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -2112,7 +2112,7 @@ void HistoryInner::onUpdateSelected() {
|
||||||
if (!dragState.link && m.x() >= st::historyPhotoLeft && m.x() < st::historyPhotoLeft + st::msgPhotoSize) {
|
if (!dragState.link && m.x() >= st::historyPhotoLeft && m.x() < st::historyPhotoLeft + st::msgPhotoSize) {
|
||||||
if (auto msg = item->toHistoryMessage()) {
|
if (auto msg = item->toHistoryMessage()) {
|
||||||
if (msg->hasFromPhoto()) {
|
if (msg->hasFromPhoto()) {
|
||||||
enumerateUserpics([&dragState, &lnkhost, &point](gsl::not_null<HistoryMessage*> message, int userpicTop) -> bool {
|
enumerateUserpics([&dragState, &lnkhost, &point](not_null<HistoryMessage*> message, int userpicTop) -> bool {
|
||||||
// stop enumeration if the userpic is below our point
|
// stop enumeration if the userpic is below our point
|
||||||
if (userpicTop > point.y()) {
|
if (userpicTop > point.y()) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -37,7 +37,7 @@ class HistoryInner : public TWidget, public Ui::AbstractTooltipShower, private b
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HistoryInner(HistoryWidget *historyWidget, gsl::not_null<Window::Controller*> controller, Ui::ScrollArea *scroll, History *history);
|
HistoryInner(HistoryWidget *historyWidget, not_null<Window::Controller*> controller, Ui::ScrollArea *scroll, History *history);
|
||||||
|
|
||||||
void messagesReceived(PeerData *peer, const QVector<MTPMessage> &messages);
|
void messagesReceived(PeerData *peer, const QVector<MTPMessage> &messages);
|
||||||
void messagesReceivedDown(PeerData *peer, const QVector<MTPMessage> &messages);
|
void messagesReceivedDown(PeerData *peer, const QVector<MTPMessage> &messages);
|
||||||
|
@ -166,7 +166,7 @@ private:
|
||||||
void scrollDateHide();
|
void scrollDateHide();
|
||||||
void keepScrollDateForNow();
|
void keepScrollDateForNow();
|
||||||
|
|
||||||
gsl::not_null<Window::Controller*> _controller;
|
not_null<Window::Controller*> _controller;
|
||||||
|
|
||||||
PeerData *_peer = nullptr;
|
PeerData *_peer = nullptr;
|
||||||
History *_migrated = nullptr;
|
History *_migrated = nullptr;
|
||||||
|
@ -274,7 +274,7 @@ private:
|
||||||
// This function finds all history items that are displayed and calls template method
|
// This function finds all history items that are displayed and calls template method
|
||||||
// for each found message (in given direction) in the passed history with passed top offset.
|
// for each found message (in given direction) in the passed history with passed top offset.
|
||||||
//
|
//
|
||||||
// Method has "bool (*Method)(gsl::not_null<HistoryItem*> item, int itemtop, int itembottom)" signature
|
// Method has "bool (*Method)(not_null<HistoryItem*> item, int itemtop, int itembottom)" signature
|
||||||
// if it returns false the enumeration stops immidiately.
|
// if it returns false the enumeration stops immidiately.
|
||||||
template <bool TopToBottom, typename Method>
|
template <bool TopToBottom, typename Method>
|
||||||
void enumerateItemsInHistory(History *history, int historytop, Method method);
|
void enumerateItemsInHistory(History *history, int historytop, Method method);
|
||||||
|
@ -294,7 +294,7 @@ private:
|
||||||
// This function finds all userpics on the left that are displayed and calls template method
|
// This function finds all userpics on the left that are displayed and calls template method
|
||||||
// for each found userpic (from the top to the bottom) using enumerateItems() method.
|
// for each found userpic (from the top to the bottom) using enumerateItems() method.
|
||||||
//
|
//
|
||||||
// Method has "bool (*Method)(gsl::not_null<HistoryMessage*> message, int userpicTop)" signature
|
// Method has "bool (*Method)(not_null<HistoryMessage*> message, int userpicTop)" signature
|
||||||
// if it returns false the enumeration stops immidiately.
|
// if it returns false the enumeration stops immidiately.
|
||||||
template <typename Method>
|
template <typename Method>
|
||||||
void enumerateUserpics(Method method);
|
void enumerateUserpics(Method method);
|
||||||
|
@ -302,7 +302,7 @@ private:
|
||||||
// This function finds all date elements that are displayed and calls template method
|
// This function finds all date elements that are displayed and calls template method
|
||||||
// for each found date element (from the bottom to the top) using enumerateItems() method.
|
// for each found date element (from the bottom to the top) using enumerateItems() method.
|
||||||
//
|
//
|
||||||
// Method has "bool (*Method)(gsl::not_null<HistoryItem*> item, int itemtop, int dateTop)" signature
|
// Method has "bool (*Method)(not_null<HistoryItem*> item, int itemtop, int dateTop)" signature
|
||||||
// if it returns false the enumeration stops immidiately.
|
// if it returns false the enumeration stops immidiately.
|
||||||
template <typename Method>
|
template <typename Method>
|
||||||
void enumerateDates(Method method);
|
void enumerateDates(Method method);
|
||||||
|
|
|
@ -744,7 +744,7 @@ void HistoryItem::nextItemChanged() {
|
||||||
setAttachToNext(false);
|
setAttachToNext(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HistoryItem::computeIsAttachToPrevious(gsl::not_null<HistoryItem*> previous) {
|
bool HistoryItem::computeIsAttachToPrevious(not_null<HistoryItem*> previous) {
|
||||||
if (!Has<HistoryMessageDate>() && !Has<HistoryMessageUnreadBar>()) {
|
if (!Has<HistoryMessageDate>() && !Has<HistoryMessageUnreadBar>()) {
|
||||||
return !isPost() && !previous->isPost()
|
return !isPost() && !previous->isPost()
|
||||||
&& !serviceMsg() && !previous->serviceMsg()
|
&& !serviceMsg() && !previous->serviceMsg()
|
||||||
|
|
|
@ -299,7 +299,7 @@ public:
|
||||||
int buttonHeight() const;
|
int buttonHeight() const;
|
||||||
virtual int buttonRadius() const = 0;
|
virtual int buttonRadius() const = 0;
|
||||||
|
|
||||||
virtual void repaint(gsl::not_null<const HistoryItem*> item) const = 0;
|
virtual void repaint(not_null<const HistoryItem*> item) const = 0;
|
||||||
virtual ~Style() {
|
virtual ~Style() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -907,7 +907,7 @@ public:
|
||||||
void clipCallback(Media::Clip::Notification notification);
|
void clipCallback(Media::Clip::Notification notification);
|
||||||
void audioTrackUpdated();
|
void audioTrackUpdated();
|
||||||
|
|
||||||
bool computeIsAttachToPrevious(gsl::not_null<HistoryItem*> previous);
|
bool computeIsAttachToPrevious(not_null<HistoryItem*> previous);
|
||||||
void setLogEntryDisplayDate(bool displayDate) {
|
void setLogEntryDisplayDate(bool displayDate) {
|
||||||
Expects(isLogEntry());
|
Expects(isLogEntry());
|
||||||
setDisplayDate(displayDate);
|
setDisplayDate(displayDate);
|
||||||
|
@ -941,8 +941,8 @@ protected:
|
||||||
void finishEdition(int oldKeyboardTop);
|
void finishEdition(int oldKeyboardTop);
|
||||||
void finishEditionToEmpty();
|
void finishEditionToEmpty();
|
||||||
|
|
||||||
gsl::not_null<History*> _history;
|
not_null<History*> _history;
|
||||||
gsl::not_null<PeerData*> _from;
|
not_null<PeerData*> _from;
|
||||||
HistoryBlock *_block = nullptr;
|
HistoryBlock *_block = nullptr;
|
||||||
int _indexInBlock = -1;
|
int _indexInBlock = -1;
|
||||||
MTPDmessage::Flags _flags = 0;
|
MTPDmessage::Flags _flags = 0;
|
||||||
|
@ -1045,7 +1045,7 @@ template <typename T>
|
||||||
class HistoryItemInstantiated {
|
class HistoryItemInstantiated {
|
||||||
public:
|
public:
|
||||||
template <typename ...Args>
|
template <typename ...Args>
|
||||||
static gsl::not_null<T*> _create(Args &&... args) {
|
static not_null<T*> _create(Args &&... args) {
|
||||||
auto result = new T(std::forward<Args>(args)...);
|
auto result = new T(std::forward<Args>(args)...);
|
||||||
result->finishCreate();
|
result->finishCreate();
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -29,7 +29,7 @@ enum class MediaInBubbleState {
|
||||||
|
|
||||||
class HistoryMedia : public HistoryElement {
|
class HistoryMedia : public HistoryElement {
|
||||||
public:
|
public:
|
||||||
HistoryMedia(gsl::not_null<HistoryItem*> parent) : _parent(parent) {
|
HistoryMedia(not_null<HistoryItem*> parent) : _parent(parent) {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual HistoryMediaType type() const = 0;
|
virtual HistoryMediaType type() const = 0;
|
||||||
|
@ -225,7 +225,7 @@ protected:
|
||||||
_parent->history()->eraseFromOverview(type, _parent->id);
|
_parent->history()->eraseFromOverview(type, _parent->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
gsl::not_null<HistoryItem*> _parent;
|
not_null<HistoryItem*> _parent;
|
||||||
int _width = 0;
|
int _width = 0;
|
||||||
MediaInBubbleState _inBubbleState = MediaInBubbleState::None;
|
MediaInBubbleState _inBubbleState = MediaInBubbleState::None;
|
||||||
|
|
||||||
|
|
|
@ -229,7 +229,7 @@ void HistoryFileMedia::checkAnimationFinished() const {
|
||||||
|
|
||||||
HistoryFileMedia::~HistoryFileMedia() = default;
|
HistoryFileMedia::~HistoryFileMedia() = default;
|
||||||
|
|
||||||
HistoryPhoto::HistoryPhoto(gsl::not_null<HistoryItem*> parent, gsl::not_null<PhotoData*> photo, const QString &caption) : HistoryFileMedia(parent)
|
HistoryPhoto::HistoryPhoto(not_null<HistoryItem*> parent, not_null<PhotoData*> photo, const QString &caption) : HistoryFileMedia(parent)
|
||||||
, _data(photo)
|
, _data(photo)
|
||||||
, _caption(st::minPhotoSize - st::msgPadding.left() - st::msgPadding.right()) {
|
, _caption(st::minPhotoSize - st::msgPadding.left() - st::msgPadding.right()) {
|
||||||
setLinks(MakeShared<PhotoOpenClickHandler>(_data), MakeShared<PhotoSaveClickHandler>(_data), MakeShared<PhotoCancelClickHandler>(_data));
|
setLinks(MakeShared<PhotoOpenClickHandler>(_data), MakeShared<PhotoSaveClickHandler>(_data), MakeShared<PhotoCancelClickHandler>(_data));
|
||||||
|
@ -239,7 +239,7 @@ HistoryPhoto::HistoryPhoto(gsl::not_null<HistoryItem*> parent, gsl::not_null<Pho
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryPhoto::HistoryPhoto(gsl::not_null<HistoryItem*> parent, gsl::not_null<PeerData*> chat, gsl::not_null<PhotoData*> photo, int32 width) : HistoryFileMedia(parent)
|
HistoryPhoto::HistoryPhoto(not_null<HistoryItem*> parent, not_null<PeerData*> chat, not_null<PhotoData*> photo, int32 width) : HistoryFileMedia(parent)
|
||||||
, _data(photo) {
|
, _data(photo) {
|
||||||
setLinks(MakeShared<PhotoOpenClickHandler>(_data, chat), MakeShared<PhotoSaveClickHandler>(_data, chat), MakeShared<PhotoCancelClickHandler>(_data, chat));
|
setLinks(MakeShared<PhotoOpenClickHandler>(_data, chat), MakeShared<PhotoSaveClickHandler>(_data, chat), MakeShared<PhotoCancelClickHandler>(_data, chat));
|
||||||
|
|
||||||
|
@ -247,10 +247,10 @@ HistoryPhoto::HistoryPhoto(gsl::not_null<HistoryItem*> parent, gsl::not_null<Pee
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryPhoto::HistoryPhoto(gsl::not_null<HistoryItem*> parent, gsl::not_null<PeerData*> chat, const MTPDphoto &photo, int32 width) : HistoryPhoto(parent, chat, App::feedPhoto(photo), width) {
|
HistoryPhoto::HistoryPhoto(not_null<HistoryItem*> parent, not_null<PeerData*> chat, const MTPDphoto &photo, int32 width) : HistoryPhoto(parent, chat, App::feedPhoto(photo), width) {
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryPhoto::HistoryPhoto(gsl::not_null<HistoryItem*> parent, const HistoryPhoto &other) : HistoryFileMedia(parent)
|
HistoryPhoto::HistoryPhoto(not_null<HistoryItem*> parent, const HistoryPhoto &other) : HistoryFileMedia(parent)
|
||||||
, _data(other._data)
|
, _data(other._data)
|
||||||
, _pixw(other._pixw)
|
, _pixw(other._pixw)
|
||||||
, _pixh(other._pixh)
|
, _pixh(other._pixh)
|
||||||
|
@ -657,7 +657,7 @@ ImagePtr HistoryPhoto::replyPreview() {
|
||||||
return _data->makeReplyPreview();
|
return _data->makeReplyPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryVideo::HistoryVideo(gsl::not_null<HistoryItem*> parent, DocumentData *document, const QString &caption) : HistoryFileMedia(parent)
|
HistoryVideo::HistoryVideo(not_null<HistoryItem*> parent, DocumentData *document, const QString &caption) : HistoryFileMedia(parent)
|
||||||
, _data(document)
|
, _data(document)
|
||||||
, _thumbw(1)
|
, _thumbw(1)
|
||||||
, _caption(st::minPhotoSize - st::msgPadding.left() - st::msgPadding.right()) {
|
, _caption(st::minPhotoSize - st::msgPadding.left() - st::msgPadding.right()) {
|
||||||
|
@ -672,7 +672,7 @@ HistoryVideo::HistoryVideo(gsl::not_null<HistoryItem*> parent, DocumentData *doc
|
||||||
_data->thumb->load();
|
_data->thumb->load();
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryVideo::HistoryVideo(gsl::not_null<HistoryItem*> parent, const HistoryVideo &other) : HistoryFileMedia(parent)
|
HistoryVideo::HistoryVideo(not_null<HistoryItem*> parent, const HistoryVideo &other) : HistoryFileMedia(parent)
|
||||||
, _data(other._data)
|
, _data(other._data)
|
||||||
, _thumbw(other._thumbw)
|
, _thumbw(other._thumbw)
|
||||||
, _caption(other._caption) {
|
, _caption(other._caption) {
|
||||||
|
@ -1048,7 +1048,7 @@ void HistoryDocumentVoice::stopSeeking() {
|
||||||
Media::Player::instance()->stopSeeking(AudioMsgId::Type::Voice);
|
Media::Player::instance()->stopSeeking(AudioMsgId::Type::Voice);
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryDocument::HistoryDocument(gsl::not_null<HistoryItem*> parent, DocumentData *document, const QString &caption) : HistoryFileMedia(parent)
|
HistoryDocument::HistoryDocument(not_null<HistoryItem*> parent, DocumentData *document, const QString &caption) : HistoryFileMedia(parent)
|
||||||
, _data(document) {
|
, _data(document) {
|
||||||
createComponents(!caption.isEmpty());
|
createComponents(!caption.isEmpty());
|
||||||
if (auto named = Get<HistoryDocumentNamed>()) {
|
if (auto named = Get<HistoryDocumentNamed>()) {
|
||||||
|
@ -1064,7 +1064,7 @@ HistoryDocument::HistoryDocument(gsl::not_null<HistoryItem*> parent, DocumentDat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryDocument::HistoryDocument(gsl::not_null<HistoryItem*> parent, const HistoryDocument &other) : HistoryFileMedia(parent)
|
HistoryDocument::HistoryDocument(not_null<HistoryItem*> parent, const HistoryDocument &other) : HistoryFileMedia(parent)
|
||||||
, RuntimeComposer()
|
, RuntimeComposer()
|
||||||
, _data(other._data) {
|
, _data(other._data) {
|
||||||
auto captioned = other.Get<HistoryDocumentCaptioned>();
|
auto captioned = other.Get<HistoryDocumentCaptioned>();
|
||||||
|
@ -1792,7 +1792,7 @@ ImagePtr HistoryDocument::replyPreview() {
|
||||||
return _data->makeReplyPreview();
|
return _data->makeReplyPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryGif::HistoryGif(gsl::not_null<HistoryItem*> parent, DocumentData *document, const QString &caption) : HistoryFileMedia(parent)
|
HistoryGif::HistoryGif(not_null<HistoryItem*> parent, DocumentData *document, const QString &caption) : HistoryFileMedia(parent)
|
||||||
, _data(document)
|
, _data(document)
|
||||||
, _caption(st::minPhotoSize - st::msgPadding.left() - st::msgPadding.right()) {
|
, _caption(st::minPhotoSize - st::msgPadding.left() - st::msgPadding.right()) {
|
||||||
setDocumentLinks(_data, true);
|
setDocumentLinks(_data, true);
|
||||||
|
@ -1806,7 +1806,7 @@ HistoryGif::HistoryGif(gsl::not_null<HistoryItem*> parent, DocumentData *documen
|
||||||
_data->thumb->load();
|
_data->thumb->load();
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryGif::HistoryGif(gsl::not_null<HistoryItem*> parent, const HistoryGif &other) : HistoryFileMedia(parent)
|
HistoryGif::HistoryGif(not_null<HistoryItem*> parent, const HistoryGif &other) : HistoryFileMedia(parent)
|
||||||
, _data(other._data)
|
, _data(other._data)
|
||||||
, _thumbw(other._thumbw)
|
, _thumbw(other._thumbw)
|
||||||
, _thumbh(other._thumbh)
|
, _thumbh(other._thumbh)
|
||||||
|
@ -2627,7 +2627,7 @@ bool HistoryGif::dataLoaded() const {
|
||||||
return (!_parent || _parent->id > 0) ? _data->loaded() : false;
|
return (!_parent || _parent->id > 0) ? _data->loaded() : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
HistorySticker::HistorySticker(gsl::not_null<HistoryItem*> parent, DocumentData *document) : HistoryMedia(parent)
|
HistorySticker::HistorySticker(not_null<HistoryItem*> parent, DocumentData *document) : HistoryMedia(parent)
|
||||||
, _data(document)
|
, _data(document)
|
||||||
, _emoji(_data->sticker()->alt) {
|
, _emoji(_data->sticker()->alt) {
|
||||||
_data->thumb->load();
|
_data->thumb->load();
|
||||||
|
@ -2923,7 +2923,7 @@ ClickHandlerPtr addContactClickHandler(HistoryItem *item) {
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
HistoryContact::HistoryContact(gsl::not_null<HistoryItem*> parent, int32 userId, const QString &first, const QString &last, const QString &phone) : HistoryMedia(parent)
|
HistoryContact::HistoryContact(not_null<HistoryItem*> parent, int32 userId, const QString &first, const QString &last, const QString &phone) : HistoryMedia(parent)
|
||||||
, _userId(userId)
|
, _userId(userId)
|
||||||
, _fname(first)
|
, _fname(first)
|
||||||
, _lname(last)
|
, _lname(last)
|
||||||
|
@ -3089,7 +3089,7 @@ void HistoryContact::updateSentMedia(const MTPMessageMedia &media) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryCall::HistoryCall(gsl::not_null<HistoryItem*> parent, const MTPDmessageActionPhoneCall &call) : HistoryMedia(parent)
|
HistoryCall::HistoryCall(not_null<HistoryItem*> parent, const MTPDmessageActionPhoneCall &call) : HistoryMedia(parent)
|
||||||
, _reason(GetReason(call)) {
|
, _reason(GetReason(call)) {
|
||||||
if (_parent->out()) {
|
if (_parent->out()) {
|
||||||
_text = lang(_reason == FinishReason::Missed ? lng_call_cancelled : lng_call_outgoing);
|
_text = lang(_reason == FinishReason::Missed ? lng_call_cancelled : lng_call_outgoing);
|
||||||
|
@ -3238,13 +3238,13 @@ int unitedLineHeight() {
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
HistoryWebPage::HistoryWebPage(gsl::not_null<HistoryItem*> parent, gsl::not_null<WebPageData*> data) : HistoryMedia(parent)
|
HistoryWebPage::HistoryWebPage(not_null<HistoryItem*> parent, not_null<WebPageData*> data) : HistoryMedia(parent)
|
||||||
, _data(data)
|
, _data(data)
|
||||||
, _title(st::msgMinWidth - st::webPageLeft)
|
, _title(st::msgMinWidth - st::webPageLeft)
|
||||||
, _description(st::msgMinWidth - st::webPageLeft) {
|
, _description(st::msgMinWidth - st::webPageLeft) {
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryWebPage::HistoryWebPage(gsl::not_null<HistoryItem*> parent, const HistoryWebPage &other) : HistoryMedia(parent)
|
HistoryWebPage::HistoryWebPage(not_null<HistoryItem*> parent, const HistoryWebPage &other) : HistoryMedia(parent)
|
||||||
, _data(other._data)
|
, _data(other._data)
|
||||||
, _attach(other._attach ? other._attach->clone(parent) : nullptr)
|
, _attach(other._attach ? other._attach->clone(parent) : nullptr)
|
||||||
, _asArticle(other._asArticle)
|
, _asArticle(other._asArticle)
|
||||||
|
@ -3784,13 +3784,13 @@ int HistoryWebPage::bottomInfoPadding() const {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryGame::HistoryGame(gsl::not_null<HistoryItem*> parent, GameData *data) : HistoryMedia(parent)
|
HistoryGame::HistoryGame(not_null<HistoryItem*> parent, GameData *data) : HistoryMedia(parent)
|
||||||
, _data(data)
|
, _data(data)
|
||||||
, _title(st::msgMinWidth - st::webPageLeft)
|
, _title(st::msgMinWidth - st::webPageLeft)
|
||||||
, _description(st::msgMinWidth - st::webPageLeft) {
|
, _description(st::msgMinWidth - st::webPageLeft) {
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryGame::HistoryGame(gsl::not_null<HistoryItem*> parent, const HistoryGame &other) : HistoryMedia(parent)
|
HistoryGame::HistoryGame(not_null<HistoryItem*> parent, const HistoryGame &other) : HistoryMedia(parent)
|
||||||
, _data(other._data)
|
, _data(other._data)
|
||||||
, _attach(other._attach ? other._attach->clone(parent) : nullptr)
|
, _attach(other._attach ? other._attach->clone(parent) : nullptr)
|
||||||
, _title(other._title)
|
, _title(other._title)
|
||||||
|
@ -4176,14 +4176,14 @@ int HistoryGame::bottomInfoPadding() const {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryInvoice::HistoryInvoice(gsl::not_null<HistoryItem*> parent, const MTPDmessageMediaInvoice &data) : HistoryMedia(parent)
|
HistoryInvoice::HistoryInvoice(not_null<HistoryItem*> parent, const MTPDmessageMediaInvoice &data) : HistoryMedia(parent)
|
||||||
, _title(st::msgMinWidth)
|
, _title(st::msgMinWidth)
|
||||||
, _description(st::msgMinWidth)
|
, _description(st::msgMinWidth)
|
||||||
, _status(st::msgMinWidth) {
|
, _status(st::msgMinWidth) {
|
||||||
fillFromData(data);
|
fillFromData(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryInvoice::HistoryInvoice(gsl::not_null<HistoryItem*> parent, const HistoryInvoice &other) : HistoryMedia(parent)
|
HistoryInvoice::HistoryInvoice(not_null<HistoryItem*> parent, const HistoryInvoice &other) : HistoryMedia(parent)
|
||||||
, _attach(other._attach ? other._attach->clone(parent) : nullptr)
|
, _attach(other._attach ? other._attach->clone(parent) : nullptr)
|
||||||
, _titleHeight(other._titleHeight)
|
, _titleHeight(other._titleHeight)
|
||||||
, _descriptionHeight(other._descriptionHeight)
|
, _descriptionHeight(other._descriptionHeight)
|
||||||
|
@ -4558,7 +4558,7 @@ int HistoryInvoice::bottomInfoPadding() const {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryLocation::HistoryLocation(gsl::not_null<HistoryItem*> parent, const LocationCoords &coords, const QString &title, const QString &description) : HistoryMedia(parent)
|
HistoryLocation::HistoryLocation(not_null<HistoryItem*> parent, const LocationCoords &coords, const QString &title, const QString &description) : HistoryMedia(parent)
|
||||||
, _data(App::location(coords))
|
, _data(App::location(coords))
|
||||||
, _title(st::msgMinWidth)
|
, _title(st::msgMinWidth)
|
||||||
, _description(st::msgMinWidth)
|
, _description(st::msgMinWidth)
|
||||||
|
@ -4574,7 +4574,7 @@ HistoryLocation::HistoryLocation(gsl::not_null<HistoryItem*> parent, const Locat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryLocation::HistoryLocation(gsl::not_null<HistoryItem*> parent, const HistoryLocation &other) : HistoryMedia(parent)
|
HistoryLocation::HistoryLocation(not_null<HistoryItem*> parent, const HistoryLocation &other) : HistoryMedia(parent)
|
||||||
, _data(other._data)
|
, _data(other._data)
|
||||||
, _title(other._title)
|
, _title(other._title)
|
||||||
, _description(other._description)
|
, _description(other._description)
|
||||||
|
|
|
@ -121,10 +121,10 @@ protected:
|
||||||
|
|
||||||
class HistoryPhoto : public HistoryFileMedia {
|
class HistoryPhoto : public HistoryFileMedia {
|
||||||
public:
|
public:
|
||||||
HistoryPhoto(gsl::not_null<HistoryItem*> parent, gsl::not_null<PhotoData*> photo, const QString &caption);
|
HistoryPhoto(not_null<HistoryItem*> parent, not_null<PhotoData*> photo, const QString &caption);
|
||||||
HistoryPhoto(gsl::not_null<HistoryItem*> parent, gsl::not_null<PeerData*> chat, gsl::not_null<PhotoData*> photo, int width);
|
HistoryPhoto(not_null<HistoryItem*> parent, not_null<PeerData*> chat, not_null<PhotoData*> photo, int width);
|
||||||
HistoryPhoto(gsl::not_null<HistoryItem*> parent, gsl::not_null<PeerData*> chat, const MTPDphoto &photo, int width);
|
HistoryPhoto(not_null<HistoryItem*> parent, not_null<PeerData*> chat, const MTPDphoto &photo, int width);
|
||||||
HistoryPhoto(gsl::not_null<HistoryItem*> parent, const HistoryPhoto &other);
|
HistoryPhoto(not_null<HistoryItem*> parent, const HistoryPhoto &other);
|
||||||
|
|
||||||
void init();
|
void init();
|
||||||
HistoryMediaType type() const override {
|
HistoryMediaType type() const override {
|
||||||
|
@ -201,7 +201,7 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
gsl::not_null<PhotoData*> _data;
|
not_null<PhotoData*> _data;
|
||||||
int16 _pixw = 1;
|
int16 _pixw = 1;
|
||||||
int16 _pixh = 1;
|
int16 _pixh = 1;
|
||||||
Text _caption;
|
Text _caption;
|
||||||
|
@ -210,8 +210,8 @@ private:
|
||||||
|
|
||||||
class HistoryVideo : public HistoryFileMedia {
|
class HistoryVideo : public HistoryFileMedia {
|
||||||
public:
|
public:
|
||||||
HistoryVideo(gsl::not_null<HistoryItem*> parent, DocumentData *document, const QString &caption);
|
HistoryVideo(not_null<HistoryItem*> parent, DocumentData *document, const QString &caption);
|
||||||
HistoryVideo(gsl::not_null<HistoryItem*> parent, const HistoryVideo &other);
|
HistoryVideo(not_null<HistoryItem*> parent, const HistoryVideo &other);
|
||||||
HistoryMediaType type() const override {
|
HistoryMediaType type() const override {
|
||||||
return MediaTypeVideo;
|
return MediaTypeVideo;
|
||||||
}
|
}
|
||||||
|
@ -287,7 +287,7 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
gsl::not_null<DocumentData*> _data;
|
not_null<DocumentData*> _data;
|
||||||
int32 _thumbw;
|
int32 _thumbw;
|
||||||
Text _caption;
|
Text _caption;
|
||||||
|
|
||||||
|
@ -360,8 +360,8 @@ private:
|
||||||
|
|
||||||
class HistoryDocument : public HistoryFileMedia, public RuntimeComposer {
|
class HistoryDocument : public HistoryFileMedia, public RuntimeComposer {
|
||||||
public:
|
public:
|
||||||
HistoryDocument(gsl::not_null<HistoryItem*> parent, DocumentData *document, const QString &caption);
|
HistoryDocument(not_null<HistoryItem*> parent, DocumentData *document, const QString &caption);
|
||||||
HistoryDocument(gsl::not_null<HistoryItem*> parent, const HistoryDocument &other);
|
HistoryDocument(not_null<HistoryItem*> parent, const HistoryDocument &other);
|
||||||
HistoryMediaType type() const override {
|
HistoryMediaType type() const override {
|
||||||
return _data->voice() ? MediaTypeVoiceFile : (_data->song() ? MediaTypeMusicFile : MediaTypeFile);
|
return _data->voice() ? MediaTypeVoiceFile : (_data->song() ? MediaTypeMusicFile : MediaTypeFile);
|
||||||
}
|
}
|
||||||
|
@ -467,14 +467,14 @@ private:
|
||||||
template <typename Callback>
|
template <typename Callback>
|
||||||
void buildStringRepresentation(Callback callback) const;
|
void buildStringRepresentation(Callback callback) const;
|
||||||
|
|
||||||
gsl::not_null<DocumentData*> _data;
|
not_null<DocumentData*> _data;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class HistoryGif : public HistoryFileMedia {
|
class HistoryGif : public HistoryFileMedia {
|
||||||
public:
|
public:
|
||||||
HistoryGif(gsl::not_null<HistoryItem*> parent, DocumentData *document, const QString &caption);
|
HistoryGif(not_null<HistoryItem*> parent, DocumentData *document, const QString &caption);
|
||||||
HistoryGif(gsl::not_null<HistoryItem*> parent, const HistoryGif &other);
|
HistoryGif(not_null<HistoryItem*> parent, const HistoryGif &other);
|
||||||
HistoryMediaType type() const override {
|
HistoryMediaType type() const override {
|
||||||
return MediaTypeGif;
|
return MediaTypeGif;
|
||||||
}
|
}
|
||||||
|
@ -570,7 +570,7 @@ private:
|
||||||
QString mediaTypeString() const;
|
QString mediaTypeString() const;
|
||||||
bool isSeparateRoundVideo() const;
|
bool isSeparateRoundVideo() const;
|
||||||
|
|
||||||
gsl::not_null<DocumentData*> _data;
|
not_null<DocumentData*> _data;
|
||||||
ClickHandlerPtr _openInMediaviewLink;
|
ClickHandlerPtr _openInMediaviewLink;
|
||||||
int32 _thumbw = 1;
|
int32 _thumbw = 1;
|
||||||
int32 _thumbh = 1;
|
int32 _thumbh = 1;
|
||||||
|
@ -586,7 +586,7 @@ private:
|
||||||
|
|
||||||
class HistorySticker : public HistoryMedia {
|
class HistorySticker : public HistoryMedia {
|
||||||
public:
|
public:
|
||||||
HistorySticker(gsl::not_null<HistoryItem*> parent, DocumentData *document);
|
HistorySticker(not_null<HistoryItem*> parent, DocumentData *document);
|
||||||
HistoryMediaType type() const override {
|
HistoryMediaType type() const override {
|
||||||
return MediaTypeSticker;
|
return MediaTypeSticker;
|
||||||
}
|
}
|
||||||
|
@ -648,14 +648,14 @@ private:
|
||||||
int16 _pixw = 1;
|
int16 _pixw = 1;
|
||||||
int16 _pixh = 1;
|
int16 _pixh = 1;
|
||||||
ClickHandlerPtr _packLink;
|
ClickHandlerPtr _packLink;
|
||||||
gsl::not_null<DocumentData*> _data;
|
not_null<DocumentData*> _data;
|
||||||
QString _emoji;
|
QString _emoji;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class HistoryContact : public HistoryMedia {
|
class HistoryContact : public HistoryMedia {
|
||||||
public:
|
public:
|
||||||
HistoryContact(gsl::not_null<HistoryItem*> parent, int32 userId, const QString &first, const QString &last, const QString &phone);
|
HistoryContact(not_null<HistoryItem*> parent, int32 userId, const QString &first, const QString &last, const QString &phone);
|
||||||
HistoryMediaType type() const override {
|
HistoryMediaType type() const override {
|
||||||
return MediaTypeContact;
|
return MediaTypeContact;
|
||||||
}
|
}
|
||||||
|
@ -717,7 +717,7 @@ private:
|
||||||
|
|
||||||
class HistoryCall : public HistoryMedia {
|
class HistoryCall : public HistoryMedia {
|
||||||
public:
|
public:
|
||||||
HistoryCall(gsl::not_null<HistoryItem*> parent, const MTPDmessageActionPhoneCall &call);
|
HistoryCall(not_null<HistoryItem*> parent, const MTPDmessageActionPhoneCall &call);
|
||||||
HistoryMediaType type() const override {
|
HistoryMediaType type() const override {
|
||||||
return MediaTypeCall;
|
return MediaTypeCall;
|
||||||
}
|
}
|
||||||
|
@ -772,8 +772,8 @@ private:
|
||||||
|
|
||||||
class HistoryWebPage : public HistoryMedia {
|
class HistoryWebPage : public HistoryMedia {
|
||||||
public:
|
public:
|
||||||
HistoryWebPage(gsl::not_null<HistoryItem*> parent, gsl::not_null<WebPageData*> data);
|
HistoryWebPage(not_null<HistoryItem*> parent, not_null<WebPageData*> data);
|
||||||
HistoryWebPage(gsl::not_null<HistoryItem*> parent, const HistoryWebPage &other);
|
HistoryWebPage(not_null<HistoryItem*> parent, const HistoryWebPage &other);
|
||||||
HistoryMediaType type() const override {
|
HistoryMediaType type() const override {
|
||||||
return MediaTypeWebPage;
|
return MediaTypeWebPage;
|
||||||
}
|
}
|
||||||
|
@ -829,7 +829,7 @@ public:
|
||||||
bool hasReplyPreview() const override;
|
bool hasReplyPreview() const override;
|
||||||
ImagePtr replyPreview() override;
|
ImagePtr replyPreview() override;
|
||||||
|
|
||||||
gsl::not_null<WebPageData*> webpage() {
|
not_null<WebPageData*> webpage() {
|
||||||
return _data;
|
return _data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -858,7 +858,7 @@ private:
|
||||||
int bottomInfoPadding() const;
|
int bottomInfoPadding() const;
|
||||||
bool isLogEntryOriginal() const;
|
bool isLogEntryOriginal() const;
|
||||||
|
|
||||||
gsl::not_null<WebPageData*> _data;
|
not_null<WebPageData*> _data;
|
||||||
ClickHandlerPtr _openl;
|
ClickHandlerPtr _openl;
|
||||||
std::unique_ptr<HistoryMedia> _attach;
|
std::unique_ptr<HistoryMedia> _attach;
|
||||||
|
|
||||||
|
@ -878,8 +878,8 @@ private:
|
||||||
|
|
||||||
class HistoryGame : public HistoryMedia {
|
class HistoryGame : public HistoryMedia {
|
||||||
public:
|
public:
|
||||||
HistoryGame(gsl::not_null<HistoryItem*> parent, GameData *data);
|
HistoryGame(not_null<HistoryItem*> parent, GameData *data);
|
||||||
HistoryGame(gsl::not_null<HistoryItem*> parent, const HistoryGame &other);
|
HistoryGame(not_null<HistoryItem*> parent, const HistoryGame &other);
|
||||||
HistoryMediaType type() const override {
|
HistoryMediaType type() const override {
|
||||||
return MediaTypeGame;
|
return MediaTypeGame;
|
||||||
}
|
}
|
||||||
|
@ -985,8 +985,8 @@ private:
|
||||||
|
|
||||||
class HistoryInvoice : public HistoryMedia {
|
class HistoryInvoice : public HistoryMedia {
|
||||||
public:
|
public:
|
||||||
HistoryInvoice(gsl::not_null<HistoryItem*> parent, const MTPDmessageMediaInvoice &data);
|
HistoryInvoice(not_null<HistoryItem*> parent, const MTPDmessageMediaInvoice &data);
|
||||||
HistoryInvoice(gsl::not_null<HistoryItem*> parent, const HistoryInvoice &other);
|
HistoryInvoice(not_null<HistoryItem*> parent, const HistoryInvoice &other);
|
||||||
HistoryMediaType type() const override {
|
HistoryMediaType type() const override {
|
||||||
return MediaTypeInvoice;
|
return MediaTypeInvoice;
|
||||||
}
|
}
|
||||||
|
@ -1079,8 +1079,8 @@ struct LocationData;
|
||||||
|
|
||||||
class HistoryLocation : public HistoryMedia {
|
class HistoryLocation : public HistoryMedia {
|
||||||
public:
|
public:
|
||||||
HistoryLocation(gsl::not_null<HistoryItem*> parent, const LocationCoords &coords, const QString &title = QString(), const QString &description = QString());
|
HistoryLocation(not_null<HistoryItem*> parent, const LocationCoords &coords, const QString &title = QString(), const QString &description = QString());
|
||||||
HistoryLocation(gsl::not_null<HistoryItem*> parent, const HistoryLocation &other);
|
HistoryLocation(not_null<HistoryItem*> parent, const HistoryLocation &other);
|
||||||
HistoryMediaType type() const override {
|
HistoryMediaType type() const override {
|
||||||
return MediaTypeLocation;
|
return MediaTypeLocation;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ style::color fromNameFgSelected(int index) {
|
||||||
return colors[index];
|
return colors[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
MTPDmessage::Flags NewForwardedFlags(gsl::not_null<PeerData*> peer, UserId from, gsl::not_null<HistoryMessage*> fwd) {
|
MTPDmessage::Flags NewForwardedFlags(not_null<PeerData*> peer, UserId from, not_null<HistoryMessage*> fwd) {
|
||||||
auto result = NewMessageFlags(peer) | MTPDmessage::Flag::f_fwd_from;
|
auto result = NewMessageFlags(peer) | MTPDmessage::Flag::f_fwd_from;
|
||||||
if (from) {
|
if (from) {
|
||||||
result |= MTPDmessage::Flag::f_from_id;
|
result |= MTPDmessage::Flag::f_from_id;
|
||||||
|
@ -170,7 +170,7 @@ bool HasInlineItems(const SelectedItemSet &items) {
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void FastShareMessage(gsl::not_null<HistoryItem*> item) {
|
void FastShareMessage(not_null<HistoryItem*> item) {
|
||||||
struct ShareData {
|
struct ShareData {
|
||||||
ShareData(const FullMsgId &msgId) : msgId(msgId) {
|
ShareData(const FullMsgId &msgId) : msgId(msgId) {
|
||||||
}
|
}
|
||||||
|
@ -291,7 +291,7 @@ base::lambda<void(ChannelData*, MsgId)> HistoryDependentItemCallback(const FullM
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
MTPDmessage::Flags NewMessageFlags(gsl::not_null<PeerData*> peer) {
|
MTPDmessage::Flags NewMessageFlags(not_null<PeerData*> peer) {
|
||||||
MTPDmessage::Flags result = 0;
|
MTPDmessage::Flags result = 0;
|
||||||
if (!peer->isSelf()) {
|
if (!peer->isSelf()) {
|
||||||
result |= MTPDmessage::Flag::f_out;
|
result |= MTPDmessage::Flag::f_out;
|
||||||
|
@ -302,7 +302,7 @@ MTPDmessage::Flags NewMessageFlags(gsl::not_null<PeerData*> peer) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString GetErrorTextForForward(gsl::not_null<PeerData*> peer, const SelectedItemSet &items) {
|
QString GetErrorTextForForward(not_null<PeerData*> peer, const SelectedItemSet &items) {
|
||||||
if (!peer->canWrite()) {
|
if (!peer->canWrite()) {
|
||||||
return lang(lng_forward_cant);
|
return lang(lng_forward_cant);
|
||||||
}
|
}
|
||||||
|
@ -551,7 +551,7 @@ const style::TextStyle &HistoryMessage::KeyboardStyle::textStyle() const {
|
||||||
return st::serviceTextStyle;
|
return st::serviceTextStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryMessage::KeyboardStyle::repaint(gsl::not_null<const HistoryItem*> item) const {
|
void HistoryMessage::KeyboardStyle::repaint(not_null<const HistoryItem*> item) const {
|
||||||
Ui::repaintHistoryItem(item);
|
Ui::repaintHistoryItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -605,7 +605,7 @@ int HistoryMessage::KeyboardStyle::minButtonWidth(HistoryMessageReplyMarkup::But
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryMessage::HistoryMessage(gsl::not_null<History*> history, const MTPDmessage &msg)
|
HistoryMessage::HistoryMessage(not_null<History*> history, const MTPDmessage &msg)
|
||||||
: HistoryItem(history, msg.vid.v, msg.vflags.v, ::date(msg.vdate), msg.has_from_id() ? msg.vfrom_id.v : 0) {
|
: HistoryItem(history, msg.vid.v, msg.vflags.v, ::date(msg.vdate), msg.has_from_id() ? msg.vfrom_id.v : 0) {
|
||||||
CreateConfig config;
|
CreateConfig config;
|
||||||
|
|
||||||
|
@ -634,7 +634,7 @@ HistoryMessage::HistoryMessage(gsl::not_null<History*> history, const MTPDmessag
|
||||||
setText({ text, entities });
|
setText({ text, entities });
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryMessage::HistoryMessage(gsl::not_null<History*> history, const MTPDmessageService &msg)
|
HistoryMessage::HistoryMessage(not_null<History*> history, const MTPDmessageService &msg)
|
||||||
: HistoryItem(history, msg.vid.v, mtpCastFlags(msg.vflags.v), ::date(msg.vdate), msg.has_from_id() ? msg.vfrom_id.v : 0) {
|
: HistoryItem(history, msg.vid.v, mtpCastFlags(msg.vflags.v), ::date(msg.vdate), msg.has_from_id() ? msg.vfrom_id.v : 0) {
|
||||||
CreateConfig config;
|
CreateConfig config;
|
||||||
|
|
||||||
|
@ -653,7 +653,7 @@ HistoryMessage::HistoryMessage(gsl::not_null<History*> history, const MTPDmessag
|
||||||
setText(TextWithEntities {});
|
setText(TextWithEntities {});
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryMessage::HistoryMessage(gsl::not_null<History*> history, MsgId id, MTPDmessage::Flags flags, QDateTime date, UserId from, const QString &postAuthor, gsl::not_null<HistoryMessage*> fwd)
|
HistoryMessage::HistoryMessage(not_null<History*> history, MsgId id, MTPDmessage::Flags flags, QDateTime date, UserId from, const QString &postAuthor, not_null<HistoryMessage*> fwd)
|
||||||
: HistoryItem(history, id, NewForwardedFlags(history->peer, from, fwd) | flags, date, from) {
|
: HistoryItem(history, id, NewForwardedFlags(history->peer, from, fwd) | flags, date, from) {
|
||||||
CreateConfig config;
|
CreateConfig config;
|
||||||
|
|
||||||
|
@ -704,14 +704,14 @@ HistoryMessage::HistoryMessage(gsl::not_null<History*> history, MsgId id, MTPDme
|
||||||
setText(fwd->originalText());
|
setText(fwd->originalText());
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryMessage::HistoryMessage(gsl::not_null<History*> history, MsgId id, MTPDmessage::Flags flags, MsgId replyTo, UserId viaBotId, QDateTime date, UserId from, const QString &postAuthor, const TextWithEntities &textWithEntities)
|
HistoryMessage::HistoryMessage(not_null<History*> history, MsgId id, MTPDmessage::Flags flags, MsgId replyTo, UserId viaBotId, QDateTime date, UserId from, const QString &postAuthor, const TextWithEntities &textWithEntities)
|
||||||
: HistoryItem(history, id, flags, date, (flags & MTPDmessage::Flag::f_from_id) ? from : 0) {
|
: HistoryItem(history, id, flags, date, (flags & MTPDmessage::Flag::f_from_id) ? from : 0) {
|
||||||
createComponentsHelper(flags, replyTo, viaBotId, postAuthor, MTPnullMarkup);
|
createComponentsHelper(flags, replyTo, viaBotId, postAuthor, MTPnullMarkup);
|
||||||
|
|
||||||
setText(textWithEntities);
|
setText(textWithEntities);
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryMessage::HistoryMessage(gsl::not_null<History*> history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, UserId viaBotId, QDateTime date, UserId from, const QString &postAuthor, DocumentData *doc, const QString &caption, const MTPReplyMarkup &markup)
|
HistoryMessage::HistoryMessage(not_null<History*> history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, UserId viaBotId, QDateTime date, UserId from, const QString &postAuthor, DocumentData *doc, const QString &caption, const MTPReplyMarkup &markup)
|
||||||
: HistoryItem(history, msgId, flags, date, (flags & MTPDmessage::Flag::f_from_id) ? from : 0) {
|
: HistoryItem(history, msgId, flags, date, (flags & MTPDmessage::Flag::f_from_id) ? from : 0) {
|
||||||
createComponentsHelper(flags, replyTo, viaBotId, postAuthor, markup);
|
createComponentsHelper(flags, replyTo, viaBotId, postAuthor, markup);
|
||||||
|
|
||||||
|
@ -719,7 +719,7 @@ HistoryMessage::HistoryMessage(gsl::not_null<History*> history, MsgId msgId, MTP
|
||||||
setText(TextWithEntities());
|
setText(TextWithEntities());
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryMessage::HistoryMessage(gsl::not_null<History*> history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, UserId viaBotId, QDateTime date, UserId from, const QString &postAuthor, PhotoData *photo, const QString &caption, const MTPReplyMarkup &markup)
|
HistoryMessage::HistoryMessage(not_null<History*> history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, UserId viaBotId, QDateTime date, UserId from, const QString &postAuthor, PhotoData *photo, const QString &caption, const MTPReplyMarkup &markup)
|
||||||
: HistoryItem(history, msgId, flags, date, (flags & MTPDmessage::Flag::f_from_id) ? from : 0) {
|
: HistoryItem(history, msgId, flags, date, (flags & MTPDmessage::Flag::f_from_id) ? from : 0) {
|
||||||
createComponentsHelper(flags, replyTo, viaBotId, postAuthor, markup);
|
createComponentsHelper(flags, replyTo, viaBotId, postAuthor, markup);
|
||||||
|
|
||||||
|
@ -727,7 +727,7 @@ HistoryMessage::HistoryMessage(gsl::not_null<History*> history, MsgId msgId, MTP
|
||||||
setText(TextWithEntities());
|
setText(TextWithEntities());
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryMessage::HistoryMessage(gsl::not_null<History*> history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, UserId viaBotId, QDateTime date, UserId from, const QString &postAuthor, GameData *game, const MTPReplyMarkup &markup)
|
HistoryMessage::HistoryMessage(not_null<History*> history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, UserId viaBotId, QDateTime date, UserId from, const QString &postAuthor, GameData *game, const MTPReplyMarkup &markup)
|
||||||
: HistoryItem(history, msgId, flags, date, (flags & MTPDmessage::Flag::f_from_id) ? from : 0) {
|
: HistoryItem(history, msgId, flags, date, (flags & MTPDmessage::Flag::f_from_id) ? from : 0) {
|
||||||
createComponentsHelper(flags, replyTo, viaBotId, postAuthor, markup);
|
createComponentsHelper(flags, replyTo, viaBotId, postAuthor, markup);
|
||||||
|
|
||||||
|
|
|
@ -22,31 +22,31 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
|
|
||||||
void HistoryInitMessages();
|
void HistoryInitMessages();
|
||||||
base::lambda<void(ChannelData*, MsgId)> HistoryDependentItemCallback(const FullMsgId &msgId);
|
base::lambda<void(ChannelData*, MsgId)> HistoryDependentItemCallback(const FullMsgId &msgId);
|
||||||
MTPDmessage::Flags NewMessageFlags(gsl::not_null<PeerData*> peer);
|
MTPDmessage::Flags NewMessageFlags(not_null<PeerData*> peer);
|
||||||
QString GetErrorTextForForward(gsl::not_null<PeerData*> peer, const SelectedItemSet &items);
|
QString GetErrorTextForForward(not_null<PeerData*> peer, const SelectedItemSet &items);
|
||||||
void FastShareMessage(gsl::not_null<HistoryItem*> item);
|
void FastShareMessage(not_null<HistoryItem*> item);
|
||||||
|
|
||||||
class HistoryMessage : public HistoryItem, private HistoryItemInstantiated<HistoryMessage> {
|
class HistoryMessage : public HistoryItem, private HistoryItemInstantiated<HistoryMessage> {
|
||||||
public:
|
public:
|
||||||
static gsl::not_null<HistoryMessage*> create(gsl::not_null<History*> history, const MTPDmessage &msg) {
|
static not_null<HistoryMessage*> create(not_null<History*> history, const MTPDmessage &msg) {
|
||||||
return _create(history, msg);
|
return _create(history, msg);
|
||||||
}
|
}
|
||||||
static gsl::not_null<HistoryMessage*> create(gsl::not_null<History*> history, const MTPDmessageService &msg) {
|
static not_null<HistoryMessage*> create(not_null<History*> history, const MTPDmessageService &msg) {
|
||||||
return _create(history, msg);
|
return _create(history, msg);
|
||||||
}
|
}
|
||||||
static gsl::not_null<HistoryMessage*> create(gsl::not_null<History*> history, MsgId msgId, MTPDmessage::Flags flags, QDateTime date, UserId from, const QString &postAuthor, gsl::not_null<HistoryMessage*> fwd) {
|
static not_null<HistoryMessage*> create(not_null<History*> history, MsgId msgId, MTPDmessage::Flags flags, QDateTime date, UserId from, const QString &postAuthor, not_null<HistoryMessage*> fwd) {
|
||||||
return _create(history, msgId, flags, date, from, postAuthor, fwd);
|
return _create(history, msgId, flags, date, from, postAuthor, fwd);
|
||||||
}
|
}
|
||||||
static gsl::not_null<HistoryMessage*> create(gsl::not_null<History*> history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, UserId viaBotId, QDateTime date, UserId from, const QString &postAuthor, const TextWithEntities &textWithEntities) {
|
static not_null<HistoryMessage*> create(not_null<History*> history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, UserId viaBotId, QDateTime date, UserId from, const QString &postAuthor, const TextWithEntities &textWithEntities) {
|
||||||
return _create(history, msgId, flags, replyTo, viaBotId, date, from, postAuthor, textWithEntities);
|
return _create(history, msgId, flags, replyTo, viaBotId, date, from, postAuthor, textWithEntities);
|
||||||
}
|
}
|
||||||
static gsl::not_null<HistoryMessage*> create(gsl::not_null<History*> history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, UserId viaBotId, QDateTime date, UserId from, const QString &postAuthor, DocumentData *doc, const QString &caption, const MTPReplyMarkup &markup) {
|
static not_null<HistoryMessage*> create(not_null<History*> history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, UserId viaBotId, QDateTime date, UserId from, const QString &postAuthor, DocumentData *doc, const QString &caption, const MTPReplyMarkup &markup) {
|
||||||
return _create(history, msgId, flags, replyTo, viaBotId, date, from, postAuthor, doc, caption, markup);
|
return _create(history, msgId, flags, replyTo, viaBotId, date, from, postAuthor, doc, caption, markup);
|
||||||
}
|
}
|
||||||
static gsl::not_null<HistoryMessage*> create(gsl::not_null<History*> history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, UserId viaBotId, QDateTime date, UserId from, const QString &postAuthor, PhotoData *photo, const QString &caption, const MTPReplyMarkup &markup) {
|
static not_null<HistoryMessage*> create(not_null<History*> history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, UserId viaBotId, QDateTime date, UserId from, const QString &postAuthor, PhotoData *photo, const QString &caption, const MTPReplyMarkup &markup) {
|
||||||
return _create(history, msgId, flags, replyTo, viaBotId, date, from, postAuthor, photo, caption, markup);
|
return _create(history, msgId, flags, replyTo, viaBotId, date, from, postAuthor, photo, caption, markup);
|
||||||
}
|
}
|
||||||
static gsl::not_null<HistoryMessage*> create(gsl::not_null<History*> history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, UserId viaBotId, QDateTime date, UserId from, const QString &postAuthor, GameData *game, const MTPReplyMarkup &markup) {
|
static not_null<HistoryMessage*> create(not_null<History*> history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, UserId viaBotId, QDateTime date, UserId from, const QString &postAuthor, GameData *game, const MTPReplyMarkup &markup) {
|
||||||
return _create(history, msgId, flags, replyTo, viaBotId, date, from, postAuthor, game, markup);
|
return _create(history, msgId, flags, replyTo, viaBotId, date, from, postAuthor, game, markup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,13 +146,13 @@ public:
|
||||||
~HistoryMessage();
|
~HistoryMessage();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HistoryMessage(gsl::not_null<History*> history, const MTPDmessage &msg);
|
HistoryMessage(not_null<History*> history, const MTPDmessage &msg);
|
||||||
HistoryMessage(gsl::not_null<History*> history, const MTPDmessageService &msg);
|
HistoryMessage(not_null<History*> history, const MTPDmessageService &msg);
|
||||||
HistoryMessage(gsl::not_null<History*> history, MsgId msgId, MTPDmessage::Flags flags, QDateTime date, UserId from, const QString &postAuthor, gsl::not_null<HistoryMessage*> fwd); // local forwarded
|
HistoryMessage(not_null<History*> history, MsgId msgId, MTPDmessage::Flags flags, QDateTime date, UserId from, const QString &postAuthor, not_null<HistoryMessage*> fwd); // local forwarded
|
||||||
HistoryMessage(gsl::not_null<History*> history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, UserId viaBotId, QDateTime date, UserId from, const QString &postAuthor, const TextWithEntities &textWithEntities); // local message
|
HistoryMessage(not_null<History*> history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, UserId viaBotId, QDateTime date, UserId from, const QString &postAuthor, const TextWithEntities &textWithEntities); // local message
|
||||||
HistoryMessage(gsl::not_null<History*> history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, UserId viaBotId, QDateTime date, UserId from, const QString &postAuthor, DocumentData *doc, const QString &caption, const MTPReplyMarkup &markup); // local document
|
HistoryMessage(not_null<History*> history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, UserId viaBotId, QDateTime date, UserId from, const QString &postAuthor, DocumentData *doc, const QString &caption, const MTPReplyMarkup &markup); // local document
|
||||||
HistoryMessage(gsl::not_null<History*> history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, UserId viaBotId, QDateTime date, UserId from, const QString &postAuthor, PhotoData *photo, const QString &caption, const MTPReplyMarkup &markup); // local photo
|
HistoryMessage(not_null<History*> history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, UserId viaBotId, QDateTime date, UserId from, const QString &postAuthor, PhotoData *photo, const QString &caption, const MTPReplyMarkup &markup); // local photo
|
||||||
HistoryMessage(gsl::not_null<History*> history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, UserId viaBotId, QDateTime date, UserId from, const QString &postAuthor, GameData *game, const MTPReplyMarkup &markup); // local game
|
HistoryMessage(not_null<History*> history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, UserId viaBotId, QDateTime date, UserId from, const QString &postAuthor, GameData *game, const MTPReplyMarkup &markup); // local game
|
||||||
friend class HistoryItemInstantiated<HistoryMessage>;
|
friend class HistoryItemInstantiated<HistoryMessage>;
|
||||||
|
|
||||||
void setEmptyText();
|
void setEmptyText();
|
||||||
|
@ -218,7 +218,7 @@ private:
|
||||||
|
|
||||||
void startPaint(Painter &p) const override;
|
void startPaint(Painter &p) const override;
|
||||||
const style::TextStyle &textStyle() const override;
|
const style::TextStyle &textStyle() const override;
|
||||||
void repaint(gsl::not_null<const HistoryItem*> item) const override;
|
void repaint(not_null<const HistoryItem*> item) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintButtonBg(Painter &p, const QRect &rect, float64 howMuchOver) const override;
|
void paintButtonBg(Painter &p, const QRect &rect, float64 howMuchOver) const override;
|
||||||
|
|
|
@ -400,17 +400,17 @@ HistoryService::PreparedText HistoryService::preparePaymentSentText() {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryService::HistoryService(gsl::not_null<History*> history, const MTPDmessage &message) :
|
HistoryService::HistoryService(not_null<History*> history, const MTPDmessage &message) :
|
||||||
HistoryItem(history, message.vid.v, message.vflags.v, ::date(message.vdate), message.has_from_id() ? message.vfrom_id.v : 0) {
|
HistoryItem(history, message.vid.v, message.vflags.v, ::date(message.vdate), message.has_from_id() ? message.vfrom_id.v : 0) {
|
||||||
createFromMtp(message);
|
createFromMtp(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryService::HistoryService(gsl::not_null<History*> history, const MTPDmessageService &message) :
|
HistoryService::HistoryService(not_null<History*> history, const MTPDmessageService &message) :
|
||||||
HistoryItem(history, message.vid.v, mtpCastFlags(message.vflags.v), ::date(message.vdate), message.has_from_id() ? message.vfrom_id.v : 0) {
|
HistoryItem(history, message.vid.v, mtpCastFlags(message.vflags.v), ::date(message.vdate), message.has_from_id() ? message.vfrom_id.v : 0) {
|
||||||
createFromMtp(message);
|
createFromMtp(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryService::HistoryService(gsl::not_null<History*> history, MsgId msgId, QDateTime date, const PreparedText &message, MTPDmessage::Flags flags, int32 from, PhotoData *photo) :
|
HistoryService::HistoryService(not_null<History*> history, MsgId msgId, QDateTime date, const PreparedText &message, MTPDmessage::Flags flags, int32 from, PhotoData *photo) :
|
||||||
HistoryItem(history, msgId, flags, date, from) {
|
HistoryItem(history, msgId, flags, date, from) {
|
||||||
setServiceText(message);
|
setServiceText(message);
|
||||||
if (photo) {
|
if (photo) {
|
||||||
|
@ -772,11 +772,11 @@ HistoryService::~HistoryService() {
|
||||||
_media.reset();
|
_media.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryJoined::HistoryJoined(gsl::not_null<History*> history, const QDateTime &inviteDate, gsl::not_null<UserData*> inviter, MTPDmessage::Flags flags)
|
HistoryJoined::HistoryJoined(not_null<History*> history, const QDateTime &inviteDate, not_null<UserData*> inviter, MTPDmessage::Flags flags)
|
||||||
: HistoryService(history, clientMsgId(), inviteDate, GenerateText(history, inviter), flags) {
|
: HistoryService(history, clientMsgId(), inviteDate, GenerateText(history, inviter), flags) {
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryJoined::PreparedText HistoryJoined::GenerateText(gsl::not_null<History*> history, gsl::not_null<UserData*> inviter) {
|
HistoryJoined::PreparedText HistoryJoined::GenerateText(not_null<History*> history, not_null<UserData*> inviter) {
|
||||||
if (inviter->id == Auth().userPeerId()) {
|
if (inviter->id == Auth().userPeerId()) {
|
||||||
return { lang(history->isMegagroup() ? lng_action_you_joined_group : lng_action_you_joined) };
|
return { lang(history->isMegagroup() ? lng_action_you_joined_group : lng_action_you_joined) };
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,13 +58,13 @@ public:
|
||||||
QList<ClickHandlerPtr> links;
|
QList<ClickHandlerPtr> links;
|
||||||
};
|
};
|
||||||
|
|
||||||
static gsl::not_null<HistoryService*> create(gsl::not_null<History*> history, const MTPDmessage &message) {
|
static not_null<HistoryService*> create(not_null<History*> history, const MTPDmessage &message) {
|
||||||
return _create(history, message);
|
return _create(history, message);
|
||||||
}
|
}
|
||||||
static gsl::not_null<HistoryService*> create(gsl::not_null<History*> history, const MTPDmessageService &message) {
|
static not_null<HistoryService*> create(not_null<History*> history, const MTPDmessageService &message) {
|
||||||
return _create(history, message);
|
return _create(history, message);
|
||||||
}
|
}
|
||||||
static gsl::not_null<HistoryService*> create(gsl::not_null<History*> history, MsgId msgId, QDateTime date, const PreparedText &message, MTPDmessage::Flags flags = 0, UserId from = 0, PhotoData *photo = nullptr) {
|
static not_null<HistoryService*> create(not_null<History*> history, MsgId msgId, QDateTime date, const PreparedText &message, MTPDmessage::Flags flags = 0, UserId from = 0, PhotoData *photo = nullptr) {
|
||||||
return _create(history, msgId, date, message, flags, from, photo);
|
return _create(history, msgId, date, message, flags, from, photo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,9 +116,9 @@ public:
|
||||||
protected:
|
protected:
|
||||||
friend class HistoryLayout::ServiceMessagePainter;
|
friend class HistoryLayout::ServiceMessagePainter;
|
||||||
|
|
||||||
HistoryService(gsl::not_null<History*> history, const MTPDmessage &message);
|
HistoryService(not_null<History*> history, const MTPDmessage &message);
|
||||||
HistoryService(gsl::not_null<History*> history, const MTPDmessageService &message);
|
HistoryService(not_null<History*> history, const MTPDmessageService &message);
|
||||||
HistoryService(gsl::not_null<History*> history, MsgId msgId, QDateTime date, const PreparedText &message, MTPDmessage::Flags flags = 0, UserId from = 0, PhotoData *photo = 0);
|
HistoryService(not_null<History*> history, MsgId msgId, QDateTime date, const PreparedText &message, MTPDmessage::Flags flags = 0, UserId from = 0, PhotoData *photo = 0);
|
||||||
friend class HistoryItemInstantiated<HistoryService>;
|
friend class HistoryItemInstantiated<HistoryService>;
|
||||||
|
|
||||||
void initDimensions() override;
|
void initDimensions() override;
|
||||||
|
@ -168,17 +168,17 @@ private:
|
||||||
|
|
||||||
class HistoryJoined : public HistoryService, private HistoryItemInstantiated<HistoryJoined> {
|
class HistoryJoined : public HistoryService, private HistoryItemInstantiated<HistoryJoined> {
|
||||||
public:
|
public:
|
||||||
static gsl::not_null<HistoryJoined*> create(gsl::not_null<History*> history, const QDateTime &inviteDate, gsl::not_null<UserData*> inviter, MTPDmessage::Flags flags) {
|
static not_null<HistoryJoined*> create(not_null<History*> history, const QDateTime &inviteDate, not_null<UserData*> inviter, MTPDmessage::Flags flags) {
|
||||||
return _create(history, inviteDate, inviter, flags);
|
return _create(history, inviteDate, inviter, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
HistoryJoined(gsl::not_null<History*> history, const QDateTime &inviteDate, gsl::not_null<UserData*> inviter, MTPDmessage::Flags flags);
|
HistoryJoined(not_null<History*> history, const QDateTime &inviteDate, not_null<UserData*> inviter, MTPDmessage::Flags flags);
|
||||||
using HistoryItemInstantiated<HistoryJoined>::_create;
|
using HistoryItemInstantiated<HistoryJoined>::_create;
|
||||||
friend class HistoryItemInstantiated<HistoryJoined>;
|
friend class HistoryItemInstantiated<HistoryJoined>;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static PreparedText GenerateText(gsl::not_null<History*> history, gsl::not_null<UserData*> inviter);
|
static PreparedText GenerateText(not_null<History*> history, not_null<UserData*> inviter);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -607,7 +607,7 @@ QPoint SilentToggle::tooltipPos() const {
|
||||||
return QCursor::pos();
|
return QCursor::pos();
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryWidget::HistoryWidget(QWidget *parent, gsl::not_null<Window::Controller*> controller) : Window::AbstractSectionWidget(parent, controller)
|
HistoryWidget::HistoryWidget(QWidget *parent, not_null<Window::Controller*> controller) : Window::AbstractSectionWidget(parent, controller)
|
||||||
, _fieldBarCancel(this, st::historyReplyCancel)
|
, _fieldBarCancel(this, st::historyReplyCancel)
|
||||||
, _topBar(this, controller)
|
, _topBar(this, controller)
|
||||||
, _scroll(this, st::historyScroll, false)
|
, _scroll(this, st::historyScroll, false)
|
||||||
|
@ -955,7 +955,7 @@ void HistoryWidget::highlightMessage(HistoryItem *context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int HistoryWidget::itemTopForHighlight(gsl::not_null<HistoryItem*> item) const {
|
int HistoryWidget::itemTopForHighlight(not_null<HistoryItem*> item) const {
|
||||||
auto itemTop = _list->itemTop(item);
|
auto itemTop = _list->itemTop(item);
|
||||||
t_assert(itemTop >= 0);
|
t_assert(itemTop >= 0);
|
||||||
|
|
||||||
|
@ -3281,7 +3281,7 @@ void HistoryWidget::hideSingleUseKeyboard(PeerData *peer, MsgId replyTo) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::app_sendBotCallback(const HistoryMessageReplyMarkup::Button *button, gsl::not_null<const HistoryItem*> msg, int row, int col) {
|
void HistoryWidget::app_sendBotCallback(const HistoryMessageReplyMarkup::Button *button, not_null<const HistoryItem*> msg, int row, int col) {
|
||||||
if (msg->id < 0 || _peer != msg->history()->peer) {
|
if (msg->id < 0 || _peer != msg->history()->peer) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -4642,7 +4642,7 @@ void HistoryWidget::grabFinish() {
|
||||||
_topShadow->show();
|
_topShadow->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HistoryWidget::ui_repaintHistoryItem(gsl::not_null<const HistoryItem*> item) {
|
void HistoryWidget::ui_repaintHistoryItem(not_null<const HistoryItem*> item) {
|
||||||
if (_peer && _list && (item->history() == _history || (_migrated && item->history() == _migrated))) {
|
if (_peer && _list && (item->history() == _history || (_migrated && item->history() == _migrated))) {
|
||||||
auto ms = getms();
|
auto ms = getms();
|
||||||
if (_lastScrolled + kSkipRepaintWhileScrollMs <= ms) {
|
if (_lastScrolled + kSkipRepaintWhileScrollMs <= ms) {
|
||||||
|
|
|
@ -170,7 +170,7 @@ class HistoryWidget final : public Window::AbstractSectionWidget, public RPCSend
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HistoryWidget(QWidget *parent, gsl::not_null<Window::Controller*> controller);
|
HistoryWidget(QWidget *parent, not_null<Window::Controller*> controller);
|
||||||
|
|
||||||
void start();
|
void start();
|
||||||
|
|
||||||
|
@ -349,9 +349,9 @@ public:
|
||||||
bool wheelEventFromFloatPlayer(QEvent *e, Window::Column myColumn, Window::Column playerColumn) override;
|
bool wheelEventFromFloatPlayer(QEvent *e, Window::Column myColumn, Window::Column playerColumn) override;
|
||||||
QRect rectForFloatPlayer(Window::Column myColumn, Window::Column playerColumn) override;
|
QRect rectForFloatPlayer(Window::Column myColumn, Window::Column playerColumn) override;
|
||||||
|
|
||||||
void app_sendBotCallback(const HistoryMessageReplyMarkup::Button *button, gsl::not_null<const HistoryItem*> msg, int row, int col);
|
void app_sendBotCallback(const HistoryMessageReplyMarkup::Button *button, not_null<const HistoryItem*> msg, int row, int col);
|
||||||
|
|
||||||
void ui_repaintHistoryItem(gsl::not_null<const HistoryItem*> item);
|
void ui_repaintHistoryItem(not_null<const HistoryItem*> item);
|
||||||
PeerData *ui_getPeerForMouseAction();
|
PeerData *ui_getPeerForMouseAction();
|
||||||
|
|
||||||
void notify_historyItemLayoutChanged(const HistoryItem *item);
|
void notify_historyItemLayoutChanged(const HistoryItem *item);
|
||||||
|
@ -662,7 +662,7 @@ private:
|
||||||
// Counts scrollTop for placing the scroll right at the unread
|
// Counts scrollTop for placing the scroll right at the unread
|
||||||
// messages bar, choosing from _history and _migrated unreadBar.
|
// messages bar, choosing from _history and _migrated unreadBar.
|
||||||
int unreadBarTop() const;
|
int unreadBarTop() const;
|
||||||
int itemTopForHighlight(gsl::not_null<HistoryItem*> item) const;
|
int itemTopForHighlight(not_null<HistoryItem*> item) const;
|
||||||
void scrollToCurrentVoiceMessage(FullMsgId fromId, FullMsgId toId);
|
void scrollToCurrentVoiceMessage(FullMsgId fromId, FullMsgId toId);
|
||||||
|
|
||||||
// Scroll to current y without updating the _lastUserScrolled time.
|
// Scroll to current y without updating the _lastUserScrolled time.
|
||||||
|
|
|
@ -37,10 +37,10 @@ namespace InlineBots {
|
||||||
namespace Layout {
|
namespace Layout {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
FileBase::FileBase(gsl::not_null<Context*> context, Result *result) : ItemBase(context, result) {
|
FileBase::FileBase(not_null<Context*> context, Result *result) : ItemBase(context, result) {
|
||||||
}
|
}
|
||||||
|
|
||||||
FileBase::FileBase(gsl::not_null<Context*> context, DocumentData *document) : ItemBase(context, document) {
|
FileBase::FileBase(not_null<Context*> context, DocumentData *document) : ItemBase(context, document) {
|
||||||
}
|
}
|
||||||
|
|
||||||
DocumentData *FileBase::getShownDocument() const {
|
DocumentData *FileBase::getShownDocument() const {
|
||||||
|
@ -94,10 +94,10 @@ ImagePtr FileBase::content_thumb() const {
|
||||||
return getResultThumb();
|
return getResultThumb();
|
||||||
}
|
}
|
||||||
|
|
||||||
Gif::Gif(gsl::not_null<Context*> context, Result *result) : FileBase(context, result) {
|
Gif::Gif(not_null<Context*> context, Result *result) : FileBase(context, result) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Gif::Gif(gsl::not_null<Context*> context, DocumentData *document, bool hasDeleteButton) : FileBase(context, document) {
|
Gif::Gif(not_null<Context*> context, DocumentData *document, bool hasDeleteButton) : FileBase(context, document) {
|
||||||
if (hasDeleteButton) {
|
if (hasDeleteButton) {
|
||||||
_delete = MakeShared<DeleteSavedGifClickHandler>(document);
|
_delete = MakeShared<DeleteSavedGifClickHandler>(document);
|
||||||
}
|
}
|
||||||
|
@ -358,7 +358,7 @@ void Gif::clipCallback(Media::Clip::Notification notification) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Sticker::Sticker(gsl::not_null<Context*> context, Result *result) : FileBase(context, result) {
|
Sticker::Sticker(not_null<Context*> context, Result *result) : FileBase(context, result) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sticker::initDimensions() {
|
void Sticker::initDimensions() {
|
||||||
|
@ -458,7 +458,7 @@ void Sticker::prepareThumb() const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Photo::Photo(gsl::not_null<Context*> context, Result *result) : ItemBase(context, result) {
|
Photo::Photo(not_null<Context*> context, Result *result) : ItemBase(context, result) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Photo::initDimensions() {
|
void Photo::initDimensions() {
|
||||||
|
@ -554,7 +554,7 @@ void Photo::prepareThumb(int32 width, int32 height, const QSize &frame) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Video::Video(gsl::not_null<Context*> context, Result *result) : FileBase(context, result)
|
Video::Video(not_null<Context*> context, Result *result) : FileBase(context, result)
|
||||||
, _link(getResultContentUrlHandler())
|
, _link(getResultContentUrlHandler())
|
||||||
, _title(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::inlineThumbSize - st::inlineThumbSkip)
|
, _title(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::inlineThumbSize - st::inlineThumbSkip)
|
||||||
, _description(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::inlineThumbSize - st::inlineThumbSkip) {
|
, _description(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::inlineThumbSize - st::inlineThumbSkip) {
|
||||||
|
@ -671,7 +671,7 @@ void CancelFileClickHandler::onClickImpl() const {
|
||||||
_result->cancelFile();
|
_result->cancelFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
File::File(gsl::not_null<Context*> context, Result *result) : FileBase(context, result)
|
File::File(not_null<Context*> context, Result *result) : FileBase(context, result)
|
||||||
, _title(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::msgFileSize - st::inlineThumbSkip)
|
, _title(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::msgFileSize - st::inlineThumbSkip)
|
||||||
, _description(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::msgFileSize - st::inlineThumbSkip)
|
, _description(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::msgFileSize - st::inlineThumbSkip)
|
||||||
, _open(MakeShared<OpenFileClickHandler>(result))
|
, _open(MakeShared<OpenFileClickHandler>(result))
|
||||||
|
@ -881,7 +881,7 @@ void File::setStatusSize(int32 newSize, int32 fullSize, int32 duration, qint64 r
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Contact::Contact(gsl::not_null<Context*> context, Result *result) : ItemBase(context, result)
|
Contact::Contact(not_null<Context*> context, Result *result) : ItemBase(context, result)
|
||||||
, _title(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::inlineThumbSize - st::inlineThumbSkip)
|
, _title(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::inlineThumbSize - st::inlineThumbSkip)
|
||||||
, _description(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::inlineThumbSize - st::inlineThumbSkip) {
|
, _description(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::inlineThumbSize - st::inlineThumbSkip) {
|
||||||
}
|
}
|
||||||
|
@ -970,7 +970,7 @@ void Contact::prepareThumb(int width, int height) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Article::Article(gsl::not_null<Context*> context, Result *result, bool withThumb) : ItemBase(context, result)
|
Article::Article(not_null<Context*> context, Result *result, bool withThumb) : ItemBase(context, result)
|
||||||
, _url(getResultUrlHandler())
|
, _url(getResultUrlHandler())
|
||||||
, _link(getResultContentUrlHandler())
|
, _link(getResultContentUrlHandler())
|
||||||
, _withThumb(withThumb)
|
, _withThumb(withThumb)
|
||||||
|
@ -1117,7 +1117,7 @@ void Article::prepareThumb(int width, int height) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::Game(gsl::not_null<Context*> context, Result *result) : ItemBase(context, result)
|
Game::Game(not_null<Context*> context, Result *result) : ItemBase(context, result)
|
||||||
, _title(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::inlineThumbSize - st::inlineThumbSkip)
|
, _title(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::inlineThumbSize - st::inlineThumbSkip)
|
||||||
, _description(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::inlineThumbSize - st::inlineThumbSkip) {
|
, _description(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::inlineThumbSize - st::inlineThumbSkip) {
|
||||||
countFrameSize();
|
countFrameSize();
|
||||||
|
|
|
@ -30,9 +30,9 @@ namespace internal {
|
||||||
|
|
||||||
class FileBase : public ItemBase {
|
class FileBase : public ItemBase {
|
||||||
public:
|
public:
|
||||||
FileBase(gsl::not_null<Context*> context, Result *result);
|
FileBase(not_null<Context*> context, Result *result);
|
||||||
// for saved gif layouts
|
// for saved gif layouts
|
||||||
FileBase(gsl::not_null<Context*> context, DocumentData *doc);
|
FileBase(not_null<Context*> context, DocumentData *doc);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DocumentData *getShownDocument() const;
|
DocumentData *getShownDocument() const;
|
||||||
|
@ -58,8 +58,8 @@ private:
|
||||||
|
|
||||||
class Gif : public FileBase {
|
class Gif : public FileBase {
|
||||||
public:
|
public:
|
||||||
Gif(gsl::not_null<Context*> context, Result *result);
|
Gif(not_null<Context*> context, Result *result);
|
||||||
Gif(gsl::not_null<Context*> context, DocumentData *doc, bool hasDeleteButton);
|
Gif(not_null<Context*> context, DocumentData *doc, bool hasDeleteButton);
|
||||||
|
|
||||||
void setPosition(int32 position) override;
|
void setPosition(int32 position) override;
|
||||||
void initDimensions() override;
|
void initDimensions() override;
|
||||||
|
@ -117,9 +117,9 @@ private:
|
||||||
|
|
||||||
class Photo : public ItemBase {
|
class Photo : public ItemBase {
|
||||||
public:
|
public:
|
||||||
Photo(gsl::not_null<Context*> context, Result *result);
|
Photo(not_null<Context*> context, Result *result);
|
||||||
// Not used anywhere currently.
|
// Not used anywhere currently.
|
||||||
//Photo(gsl::not_null<Context*> context, PhotoData *photo);
|
//Photo(not_null<Context*> context, PhotoData *photo);
|
||||||
|
|
||||||
void initDimensions() override;
|
void initDimensions() override;
|
||||||
|
|
||||||
|
@ -146,9 +146,9 @@ private:
|
||||||
|
|
||||||
class Sticker : public FileBase {
|
class Sticker : public FileBase {
|
||||||
public:
|
public:
|
||||||
Sticker(gsl::not_null<Context*> context, Result *result);
|
Sticker(not_null<Context*> context, Result *result);
|
||||||
// Not used anywhere currently.
|
// Not used anywhere currently.
|
||||||
//Sticker(gsl::not_null<Context*> context, DocumentData *document);
|
//Sticker(not_null<Context*> context, DocumentData *document);
|
||||||
|
|
||||||
void initDimensions() override;
|
void initDimensions() override;
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ private:
|
||||||
|
|
||||||
class Video : public FileBase {
|
class Video : public FileBase {
|
||||||
public:
|
public:
|
||||||
Video(gsl::not_null<Context*> context, Result *result);
|
Video(not_null<Context*> context, Result *result);
|
||||||
|
|
||||||
void initDimensions() override;
|
void initDimensions() override;
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ private:
|
||||||
|
|
||||||
class File : public FileBase {
|
class File : public FileBase {
|
||||||
public:
|
public:
|
||||||
File(gsl::not_null<Context*> context, Result *result);
|
File(not_null<Context*> context, Result *result);
|
||||||
|
|
||||||
void initDimensions() override;
|
void initDimensions() override;
|
||||||
|
|
||||||
|
@ -289,7 +289,7 @@ private:
|
||||||
|
|
||||||
class Contact : public ItemBase {
|
class Contact : public ItemBase {
|
||||||
public:
|
public:
|
||||||
Contact(gsl::not_null<Context*> context, Result *result);
|
Contact(not_null<Context*> context, Result *result);
|
||||||
|
|
||||||
void initDimensions() override;
|
void initDimensions() override;
|
||||||
int resizeGetHeight(int width) override;
|
int resizeGetHeight(int width) override;
|
||||||
|
@ -307,7 +307,7 @@ private:
|
||||||
|
|
||||||
class Article : public ItemBase {
|
class Article : public ItemBase {
|
||||||
public:
|
public:
|
||||||
Article(gsl::not_null<Context*> context, Result *result, bool withThumb);
|
Article(not_null<Context*> context, Result *result, bool withThumb);
|
||||||
|
|
||||||
void initDimensions() override;
|
void initDimensions() override;
|
||||||
int resizeGetHeight(int width) override;
|
int resizeGetHeight(int width) override;
|
||||||
|
@ -330,7 +330,7 @@ private:
|
||||||
|
|
||||||
class Game : public ItemBase {
|
class Game : public ItemBase {
|
||||||
public:
|
public:
|
||||||
Game(gsl::not_null<Context*> context, Result *result);
|
Game(not_null<Context*> context, Result *result);
|
||||||
|
|
||||||
void setPosition(int32 position) override;
|
void setPosition(int32 position) override;
|
||||||
void initDimensions() override;
|
void initDimensions() override;
|
||||||
|
|
|
@ -105,7 +105,7 @@ void ItemBase::layoutChanged() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<ItemBase> ItemBase::createLayout(gsl::not_null<Context*> context, Result *result, bool forceThumb) {
|
std::unique_ptr<ItemBase> ItemBase::createLayout(not_null<Context*> context, Result *result, bool forceThumb) {
|
||||||
using Type = Result::Type;
|
using Type = Result::Type;
|
||||||
|
|
||||||
switch (result->_type) {
|
switch (result->_type) {
|
||||||
|
@ -124,7 +124,7 @@ std::unique_ptr<ItemBase> ItemBase::createLayout(gsl::not_null<Context*> context
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<ItemBase> ItemBase::createLayoutGif(gsl::not_null<Context*> context, DocumentData *document) {
|
std::unique_ptr<ItemBase> ItemBase::createLayoutGif(not_null<Context*> context, DocumentData *document) {
|
||||||
return std::make_unique<internal::Gif>(context, document, true);
|
return std::make_unique<internal::Gif>(context, document, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,12 +56,12 @@ public:
|
||||||
|
|
||||||
class ItemBase : public LayoutItemBase {
|
class ItemBase : public LayoutItemBase {
|
||||||
public:
|
public:
|
||||||
ItemBase(gsl::not_null<Context*> context, Result *result) : _result(result), _context(context) {
|
ItemBase(not_null<Context*> context, Result *result) : _result(result), _context(context) {
|
||||||
}
|
}
|
||||||
ItemBase(gsl::not_null<Context*> context, DocumentData *doc) : _doc(doc), _context(context) {
|
ItemBase(not_null<Context*> context, DocumentData *doc) : _doc(doc), _context(context) {
|
||||||
}
|
}
|
||||||
// Not used anywhere currently.
|
// Not used anywhere currently.
|
||||||
//ItemBase(gsl::not_null<Context*> context, PhotoData *photo) : _photo(photo), _context(context) {
|
//ItemBase(not_null<Context*> context, PhotoData *photo) : _photo(photo), _context(context) {
|
||||||
//}
|
//}
|
||||||
|
|
||||||
virtual void paint(Painter &p, const QRect &clip, const PaintContext *context) const = 0;
|
virtual void paint(Painter &p, const QRect &clip, const PaintContext *context) const = 0;
|
||||||
|
@ -98,8 +98,8 @@ public:
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::unique_ptr<ItemBase> createLayout(gsl::not_null<Context*> context, Result *result, bool forceThumb);
|
static std::unique_ptr<ItemBase> createLayout(not_null<Context*> context, Result *result, bool forceThumb);
|
||||||
static std::unique_ptr<ItemBase> createLayoutGif(gsl::not_null<Context*> context, DocumentData *document);
|
static std::unique_ptr<ItemBase> createLayoutGif(not_null<Context*> context, DocumentData *document);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
DocumentData *getResultDocument() const;
|
DocumentData *getResultDocument() const;
|
||||||
|
@ -112,7 +112,7 @@ protected:
|
||||||
ClickHandlerPtr getResultContentUrlHandler() const;
|
ClickHandlerPtr getResultContentUrlHandler() const;
|
||||||
QString getResultThumbLetter() const;
|
QString getResultThumbLetter() const;
|
||||||
|
|
||||||
gsl::not_null<Context*> context() const {
|
not_null<Context*> context() const {
|
||||||
return _context;
|
return _context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ protected:
|
||||||
int _position = 0; // < 0 means removed from layout
|
int _position = 0; // < 0 means removed from layout
|
||||||
|
|
||||||
private:
|
private:
|
||||||
gsl::not_null<Context*> _context;
|
not_null<Context*> _context;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ constexpr auto kInlineBotRequestDelay = 400;
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Inner::Inner(QWidget *parent, gsl::not_null<Window::Controller*> controller) : TWidget(parent)
|
Inner::Inner(QWidget *parent, not_null<Window::Controller*> controller) : TWidget(parent)
|
||||||
, _controller(controller) {
|
, _controller(controller) {
|
||||||
resize(st::emojiPanWidth - st::emojiScroll.width - st::buttonRadius, st::emojiPanMinHeight);
|
resize(st::emojiPanWidth - st::emojiScroll.width - st::buttonRadius, st::emojiPanMinHeight);
|
||||||
|
|
||||||
|
@ -711,7 +711,7 @@ void Inner::onSwitchPm() {
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
||||||
Widget::Widget(QWidget *parent, gsl::not_null<Window::Controller*> controller) : TWidget(parent)
|
Widget::Widget(QWidget *parent, not_null<Window::Controller*> controller) : TWidget(parent)
|
||||||
, _controller(controller)
|
, _controller(controller)
|
||||||
, _contentMaxHeight(st::emojiPanMaxHeight)
|
, _contentMaxHeight(st::emojiPanMaxHeight)
|
||||||
, _contentHeight(_contentMaxHeight)
|
, _contentHeight(_contentMaxHeight)
|
||||||
|
|
|
@ -63,7 +63,7 @@ class Inner : public TWidget, public Context, private base::Subscriber {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Inner(QWidget *parent, gsl::not_null<Window::Controller*> controller);
|
Inner(QWidget *parent, not_null<Window::Controller*> controller);
|
||||||
|
|
||||||
void hideFinish(bool completely);
|
void hideFinish(bool completely);
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ private:
|
||||||
|
|
||||||
void refreshSwitchPmButton(const CacheEntry *entry);
|
void refreshSwitchPmButton(const CacheEntry *entry);
|
||||||
|
|
||||||
gsl::not_null<Window::Controller*> _controller;
|
not_null<Window::Controller*> _controller;
|
||||||
|
|
||||||
int _visibleTop = 0;
|
int _visibleTop = 0;
|
||||||
int _visibleBottom = 0;
|
int _visibleBottom = 0;
|
||||||
|
@ -170,7 +170,7 @@ class Widget : public TWidget, private MTP::Sender {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Widget(QWidget *parent, gsl::not_null<Window::Controller*> controller);
|
Widget(QWidget *parent, not_null<Window::Controller*> controller);
|
||||||
|
|
||||||
void moveBottom(int bottom);
|
void moveBottom(int bottom);
|
||||||
|
|
||||||
|
@ -240,7 +240,7 @@ private:
|
||||||
bool refreshInlineRows(int *added = nullptr);
|
bool refreshInlineRows(int *added = nullptr);
|
||||||
void inlineResultsDone(const MTPmessages_BotResults &result);
|
void inlineResultsDone(const MTPmessages_BotResults &result);
|
||||||
|
|
||||||
gsl::not_null<Window::Controller*> _controller;
|
not_null<Window::Controller*> _controller;
|
||||||
|
|
||||||
int _contentMaxHeight = 0;
|
int _contentMaxHeight = 0;
|
||||||
int _contentHeight = 0;
|
int _contentHeight = 0;
|
||||||
|
|
|
@ -32,7 +32,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
|
|
||||||
namespace Lang {
|
namespace Lang {
|
||||||
|
|
||||||
CloudManager::CloudManager(Instance &langpack, gsl::not_null<MTP::Instance*> mtproto) : MTP::Sender()
|
CloudManager::CloudManager(Instance &langpack, not_null<MTP::Instance*> mtproto) : MTP::Sender()
|
||||||
, _langpack(langpack) {
|
, _langpack(langpack) {
|
||||||
requestLangPackDifference();
|
requestLangPackDifference();
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ class Instance;
|
||||||
|
|
||||||
class CloudManager : public base::enable_weak_from_this, private MTP::Sender, private base::Subscriber {
|
class CloudManager : public base::enable_weak_from_this, private MTP::Sender, private base::Subscriber {
|
||||||
public:
|
public:
|
||||||
CloudManager(Instance &langpack, gsl::not_null<MTP::Instance*> mtproto);
|
CloudManager(Instance &langpack, not_null<MTP::Instance*> mtproto);
|
||||||
|
|
||||||
struct Language {
|
struct Language {
|
||||||
QString id;
|
QString id;
|
||||||
|
|
|
@ -730,7 +730,7 @@ LayerStackWidget::~LayerStackWidget() {
|
||||||
if (App::wnd()) App::wnd()->noLayerStack(this);
|
if (App::wnd()) App::wnd()->noLayerStack(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
MediaPreviewWidget::MediaPreviewWidget(QWidget *parent, gsl::not_null<Window::Controller*> controller) : TWidget(parent)
|
MediaPreviewWidget::MediaPreviewWidget(QWidget *parent, not_null<Window::Controller*> controller) : TWidget(parent)
|
||||||
, _controller(controller)
|
, _controller(controller)
|
||||||
, _emojiSize(Ui::Emoji::Size(Ui::Emoji::Index() + 1) / cIntRetinaFactor()) {
|
, _emojiSize(Ui::Emoji::Size(Ui::Emoji::Index() + 1) / cIntRetinaFactor()) {
|
||||||
setAttribute(Qt::WA_TransparentForMouseEvents);
|
setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||||
|
|
|
@ -169,7 +169,7 @@ class MediaPreviewWidget : public TWidget, private base::Subscriber {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MediaPreviewWidget(QWidget *parent, gsl::not_null<Window::Controller*> controller);
|
MediaPreviewWidget(QWidget *parent, not_null<Window::Controller*> controller);
|
||||||
|
|
||||||
void showPreview(DocumentData *document);
|
void showPreview(DocumentData *document);
|
||||||
void showPreview(PhotoData *photo);
|
void showPreview(PhotoData *photo);
|
||||||
|
@ -188,7 +188,7 @@ private:
|
||||||
void fillEmojiString();
|
void fillEmojiString();
|
||||||
void resetGifAndCache();
|
void resetGifAndCache();
|
||||||
|
|
||||||
gsl::not_null<Window::Controller*> _controller;
|
not_null<Window::Controller*> _controller;
|
||||||
|
|
||||||
Animation _a_shown;
|
Animation _a_shown;
|
||||||
bool _hiding = false;
|
bool _hiding = false;
|
||||||
|
@ -197,7 +197,7 @@ private:
|
||||||
Media::Clip::ReaderPointer _gif;
|
Media::Clip::ReaderPointer _gif;
|
||||||
|
|
||||||
int _emojiSize;
|
int _emojiSize;
|
||||||
std::vector<gsl::not_null<EmojiPtr>> _emojiList;
|
std::vector<not_null<EmojiPtr>> _emojiList;
|
||||||
|
|
||||||
void clipCallback(Media::Clip::Notification notification);
|
void clipCallback(Media::Clip::Notification notification);
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ MainWidget::Float::Float(QWidget *parent, HistoryItem *item, ToggleCallback togg
|
||||||
}) {
|
}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWidget::MainWidget(QWidget *parent, gsl::not_null<Window::Controller*> controller) : TWidget(parent)
|
MainWidget::MainWidget(QWidget *parent, not_null<Window::Controller*> controller) : TWidget(parent)
|
||||||
, _controller(controller)
|
, _controller(controller)
|
||||||
, _dialogsWidth(st::dialogsWidthMin)
|
, _dialogsWidth(st::dialogsWidthMin)
|
||||||
, _sideShadow(this, st::shadowFg)
|
, _sideShadow(this, st::shadowFg)
|
||||||
|
@ -251,10 +251,10 @@ void MainWidget::checkCurrentFloatPlayer() {
|
||||||
if (auto media = item->getMedia()) {
|
if (auto media = item->getMedia()) {
|
||||||
if (auto document = media->getDocument()) {
|
if (auto document = media->getDocument()) {
|
||||||
if (document->isRoundVideo()) {
|
if (document->isRoundVideo()) {
|
||||||
_playerFloats.push_back(std::make_unique<Float>(this, item, [this](gsl::not_null<Float*> instance, bool visible) {
|
_playerFloats.push_back(std::make_unique<Float>(this, item, [this](not_null<Float*> instance, bool visible) {
|
||||||
instance->hiddenByWidget = !visible;
|
instance->hiddenByWidget = !visible;
|
||||||
toggleFloatPlayer(instance);
|
toggleFloatPlayer(instance);
|
||||||
}, [this](gsl::not_null<Float*> instance, bool closed) {
|
}, [this](not_null<Float*> instance, bool closed) {
|
||||||
finishFloatPlayerDrag(instance, closed);
|
finishFloatPlayerDrag(instance, closed);
|
||||||
}));
|
}));
|
||||||
currentFloatPlayer()->column = Auth().data().floatPlayerColumn();
|
currentFloatPlayer()->column = Auth().data().floatPlayerColumn();
|
||||||
|
@ -267,7 +267,7 @@ void MainWidget::checkCurrentFloatPlayer() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::toggleFloatPlayer(gsl::not_null<Float*> instance) {
|
void MainWidget::toggleFloatPlayer(not_null<Float*> instance) {
|
||||||
auto visible = !instance->hiddenByHistory && !instance->hiddenByWidget && instance->widget->isReady();
|
auto visible = !instance->hiddenByHistory && !instance->hiddenByWidget && instance->widget->isReady();
|
||||||
if (instance->visible != visible) {
|
if (instance->visible != visible) {
|
||||||
instance->widget->resetMouseState();
|
instance->widget->resetMouseState();
|
||||||
|
@ -298,7 +298,7 @@ void MainWidget::checkFloatPlayerVisibility() {
|
||||||
updateFloatPlayerPosition(instance);
|
updateFloatPlayerPosition(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::updateFloatPlayerPosition(gsl::not_null<Float*> instance) {
|
void MainWidget::updateFloatPlayerPosition(not_null<Float*> instance) {
|
||||||
auto visible = instance->visibleAnimation.current(instance->visible ? 1. : 0.);
|
auto visible = instance->visibleAnimation.current(instance->visible ? 1. : 0.);
|
||||||
if (visible == 0. && !instance->visible) {
|
if (visible == 0. && !instance->visible) {
|
||||||
instance->widget->hide();
|
instance->widget->hide();
|
||||||
|
@ -347,7 +347,7 @@ QPoint MainWidget::getFloatPlayerHiddenPosition(QPoint position, QSize size, Rec
|
||||||
Unexpected("Bad side in MainWidget::getFloatPlayerHiddenPosition().");
|
Unexpected("Bad side in MainWidget::getFloatPlayerHiddenPosition().");
|
||||||
}
|
}
|
||||||
|
|
||||||
QPoint MainWidget::getFloatPlayerPosition(gsl::not_null<Float*> instance) const {
|
QPoint MainWidget::getFloatPlayerPosition(not_null<Float*> instance) const {
|
||||||
auto column = instance->column;
|
auto column = instance->column;
|
||||||
auto section = getFloatPlayerSection(&column);
|
auto section = getFloatPlayerSection(&column);
|
||||||
auto rect = section->rectForFloatPlayer(column, instance->column);
|
auto rect = section->rectForFloatPlayer(column, instance->column);
|
||||||
|
@ -376,7 +376,7 @@ RectPart MainWidget::getFloatPlayerSide(QPoint center) const {
|
||||||
return RectPart::Bottom;
|
return RectPart::Bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::removeFloatPlayer(gsl::not_null<Float*> instance) {
|
void MainWidget::removeFloatPlayer(not_null<Float*> instance) {
|
||||||
auto widget = std::move(instance->widget);
|
auto widget = std::move(instance->widget);
|
||||||
auto i = std::find_if(_playerFloats.begin(), _playerFloats.end(), [instance](auto &item) {
|
auto i = std::find_if(_playerFloats.begin(), _playerFloats.end(), [instance](auto &item) {
|
||||||
return (item.get() == instance);
|
return (item.get() == instance);
|
||||||
|
@ -391,7 +391,7 @@ void MainWidget::removeFloatPlayer(gsl::not_null<Float*> instance) {
|
||||||
widget.destroy();
|
widget.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
Window::AbstractSectionWidget *MainWidget::getFloatPlayerSection(gsl::not_null<Window::Column*> column) const {
|
Window::AbstractSectionWidget *MainWidget::getFloatPlayerSection(not_null<Window::Column*> column) const {
|
||||||
if (!Adaptive::Normal()) {
|
if (!Adaptive::Normal()) {
|
||||||
*column = Adaptive::OneColumn() ? Window::Column::First : Window::Column::Second;
|
*column = Adaptive::OneColumn() ? Window::Column::First : Window::Column::Second;
|
||||||
if (Adaptive::OneColumn() && selectingPeer()) {
|
if (Adaptive::OneColumn() && selectingPeer()) {
|
||||||
|
@ -476,7 +476,7 @@ void MainWidget::updateFloatPlayerColumnCorner(QPoint center) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::finishFloatPlayerDrag(gsl::not_null<Float*> instance, bool closed) {
|
void MainWidget::finishFloatPlayerDrag(not_null<Float*> instance, bool closed) {
|
||||||
instance->dragFrom = instance->widget->pos();
|
instance->dragFrom = instance->widget->pos();
|
||||||
auto center = instance->widget->geometry().center();
|
auto center = instance->widget->geometry().center();
|
||||||
if (closed) {
|
if (closed) {
|
||||||
|
@ -795,7 +795,7 @@ void MainWidget::notify_migrateUpdated(PeerData *peer) {
|
||||||
_history->notify_migrateUpdated(peer);
|
_history->notify_migrateUpdated(peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::ui_repaintHistoryItem(gsl::not_null<const HistoryItem*> item) {
|
void MainWidget::ui_repaintHistoryItem(not_null<const HistoryItem*> item) {
|
||||||
if (item->isLogEntry()) {
|
if (item->isLogEntry()) {
|
||||||
Auth().data().repaintLogEntry().notify(item, true);
|
Auth().data().repaintLogEntry().notify(item, true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1165,7 +1165,7 @@ void MainWidget::clearHistory(PeerData *peer) {
|
||||||
MTP::send(MTPmessages_DeleteHistory(MTP_flags(flags), peer->input, MTP_int(0)), rpcDone(&MainWidget::deleteHistoryPart, request));
|
MTP::send(MTPmessages_DeleteHistory(MTP_flags(flags), peer->input, MTP_int(0)), rpcDone(&MainWidget::deleteHistoryPart, request));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::addParticipants(PeerData *chatOrChannel, const std::vector<gsl::not_null<UserData*>> &users) {
|
void MainWidget::addParticipants(PeerData *chatOrChannel, const std::vector<not_null<UserData*>> &users) {
|
||||||
if (chatOrChannel->isChat()) {
|
if (chatOrChannel->isChat()) {
|
||||||
auto chat = chatOrChannel->asChat();
|
auto chat = chatOrChannel->asChat();
|
||||||
for_const (auto user, users) {
|
for_const (auto user, users) {
|
||||||
|
@ -1970,7 +1970,7 @@ void MainWidget::inlineResultLoadFailed(FileLoader *loader, bool started) {
|
||||||
//Ui::repaintInlineItem();
|
//Ui::repaintInlineItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::mediaMarkRead(gsl::not_null<DocumentData*> data) {
|
void MainWidget::mediaMarkRead(not_null<DocumentData*> data) {
|
||||||
auto &items = App::documentItems();
|
auto &items = App::documentItems();
|
||||||
auto i = items.constFind(data);
|
auto i = items.constFind(data);
|
||||||
if (i != items.cend()) {
|
if (i != items.cend()) {
|
||||||
|
@ -2002,7 +2002,7 @@ void MainWidget::mediaMarkRead(const HistoryItemsMap &items) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWidget::mediaMarkRead(gsl::not_null<HistoryItem*> item) {
|
void MainWidget::mediaMarkRead(not_null<HistoryItem*> item) {
|
||||||
if ((!item->out() || item->mentionsMe()) && item->isMediaUnread()) {
|
if ((!item->out() || item->mentionsMe()) && item->isMediaUnread()) {
|
||||||
item->markMediaRead();
|
item->markMediaRead();
|
||||||
if (item->id > 0) {
|
if (item->id > 0) {
|
||||||
|
|
|
@ -153,7 +153,7 @@ class MainWidget : public TWidget, public RPCSender, private base::Subscriber {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainWidget(QWidget *parent, gsl::not_null<Window::Controller*> controller);
|
MainWidget(QWidget *parent, not_null<Window::Controller*> controller);
|
||||||
|
|
||||||
bool isSectionShown() const;
|
bool isSectionShown() const;
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ public:
|
||||||
void clearHistory(PeerData *peer);
|
void clearHistory(PeerData *peer);
|
||||||
void deleteAllFromUser(ChannelData *channel, UserData *from);
|
void deleteAllFromUser(ChannelData *channel, UserData *from);
|
||||||
|
|
||||||
void addParticipants(PeerData *chatOrChannel, const std::vector<gsl::not_null<UserData*>> &users);
|
void addParticipants(PeerData *chatOrChannel, const std::vector<not_null<UserData*>> &users);
|
||||||
struct UserAndPeer {
|
struct UserAndPeer {
|
||||||
UserData *user;
|
UserData *user;
|
||||||
PeerData *peer;
|
PeerData *peer;
|
||||||
|
@ -316,7 +316,7 @@ public:
|
||||||
void hideSingleUseKeyboard(PeerData *peer, MsgId replyTo);
|
void hideSingleUseKeyboard(PeerData *peer, MsgId replyTo);
|
||||||
bool insertBotCommand(const QString &cmd);
|
bool insertBotCommand(const QString &cmd);
|
||||||
|
|
||||||
void jumpToDate(gsl::not_null<PeerData*> peer, const QDate &date);
|
void jumpToDate(not_null<PeerData*> peer, const QDate &date);
|
||||||
void searchMessages(const QString &query, PeerData *inPeer);
|
void searchMessages(const QString &query, PeerData *inPeer);
|
||||||
bool preloadOverview(PeerData *peer, MediaOverviewType type);
|
bool preloadOverview(PeerData *peer, MediaOverviewType type);
|
||||||
void itemEdited(HistoryItem *item);
|
void itemEdited(HistoryItem *item);
|
||||||
|
@ -348,9 +348,9 @@ public:
|
||||||
void cancelForwarding(History *history);
|
void cancelForwarding(History *history);
|
||||||
void finishForwarding(History *history, bool silent); // send them
|
void finishForwarding(History *history, bool silent); // send them
|
||||||
|
|
||||||
void mediaMarkRead(gsl::not_null<DocumentData*> data);
|
void mediaMarkRead(not_null<DocumentData*> data);
|
||||||
void mediaMarkRead(const HistoryItemsMap &items);
|
void mediaMarkRead(const HistoryItemsMap &items);
|
||||||
void mediaMarkRead(gsl::not_null<HistoryItem*> item);
|
void mediaMarkRead(not_null<HistoryItem*> item);
|
||||||
|
|
||||||
void webPageUpdated(WebPageData *page);
|
void webPageUpdated(WebPageData *page);
|
||||||
void gameUpdated(GameData *game);
|
void gameUpdated(GameData *game);
|
||||||
|
@ -385,7 +385,7 @@ public:
|
||||||
|
|
||||||
void app_sendBotCallback(const HistoryMessageReplyMarkup::Button *button, const HistoryItem *msg, int row, int col);
|
void app_sendBotCallback(const HistoryMessageReplyMarkup::Button *button, const HistoryItem *msg, int row, int col);
|
||||||
|
|
||||||
void ui_repaintHistoryItem(gsl::not_null<const HistoryItem*> item);
|
void ui_repaintHistoryItem(not_null<const HistoryItem*> item);
|
||||||
void ui_showPeerHistory(quint64 peer, qint32 msgId, Ui::ShowWay way);
|
void ui_showPeerHistory(quint64 peer, qint32 msgId, Ui::ShowWay way);
|
||||||
PeerData *ui_getPeerForMouseAction();
|
PeerData *ui_getPeerForMouseAction();
|
||||||
|
|
||||||
|
@ -569,17 +569,17 @@ private:
|
||||||
|
|
||||||
void clearCachedBackground();
|
void clearCachedBackground();
|
||||||
void checkCurrentFloatPlayer();
|
void checkCurrentFloatPlayer();
|
||||||
void toggleFloatPlayer(gsl::not_null<Float*> instance);
|
void toggleFloatPlayer(not_null<Float*> instance);
|
||||||
void checkFloatPlayerVisibility();
|
void checkFloatPlayerVisibility();
|
||||||
void updateFloatPlayerPosition(gsl::not_null<Float*> instance);
|
void updateFloatPlayerPosition(not_null<Float*> instance);
|
||||||
void removeFloatPlayer(gsl::not_null<Float*> instance);
|
void removeFloatPlayer(not_null<Float*> instance);
|
||||||
Float *currentFloatPlayer() const {
|
Float *currentFloatPlayer() const {
|
||||||
return _playerFloats.empty() ? nullptr : _playerFloats.back().get();
|
return _playerFloats.empty() ? nullptr : _playerFloats.back().get();
|
||||||
}
|
}
|
||||||
Window::AbstractSectionWidget *getFloatPlayerSection(gsl::not_null<Window::Column*> column) const;
|
Window::AbstractSectionWidget *getFloatPlayerSection(not_null<Window::Column*> column) const;
|
||||||
void finishFloatPlayerDrag(gsl::not_null<Float*> instance, bool closed);
|
void finishFloatPlayerDrag(not_null<Float*> instance, bool closed);
|
||||||
void updateFloatPlayerColumnCorner(QPoint center);
|
void updateFloatPlayerColumnCorner(QPoint center);
|
||||||
QPoint getFloatPlayerPosition(gsl::not_null<Float*> instance) const;
|
QPoint getFloatPlayerPosition(not_null<Float*> instance) const;
|
||||||
QPoint getFloatPlayerHiddenPosition(QPoint position, QSize size, RectPart side) const;
|
QPoint getFloatPlayerHiddenPosition(QPoint position, QSize size, RectPart side) const;
|
||||||
RectPart getFloatPlayerSide(QPoint center) const;
|
RectPart getFloatPlayerSide(QPoint center) const;
|
||||||
|
|
||||||
|
@ -591,7 +591,7 @@ private:
|
||||||
void viewsIncrementDone(QVector<MTPint> ids, const MTPVector<MTPint> &result, mtpRequestId req);
|
void viewsIncrementDone(QVector<MTPint> ids, const MTPVector<MTPint> &result, mtpRequestId req);
|
||||||
bool viewsIncrementFail(const RPCError &error, mtpRequestId req);
|
bool viewsIncrementFail(const RPCError &error, mtpRequestId req);
|
||||||
|
|
||||||
gsl::not_null<Window::Controller*> _controller;
|
not_null<Window::Controller*> _controller;
|
||||||
bool _started = false;
|
bool _started = false;
|
||||||
|
|
||||||
OrderedSet<WebPageId> _webPagesUpdated;
|
OrderedSet<WebPageId> _webPagesUpdated;
|
||||||
|
|
|
@ -54,7 +54,7 @@ ALuint CreateBuffer() {
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
Track::Track(gsl::not_null<Instance*> instance) : _instance(instance) {
|
Track::Track(not_null<Instance*> instance) : _instance(instance) {
|
||||||
_instance->registerTrack(this);
|
_instance->registerTrack(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ class Instance;
|
||||||
|
|
||||||
class Track {
|
class Track {
|
||||||
public:
|
public:
|
||||||
Track(gsl::not_null<Instance*> instance);
|
Track(not_null<Instance*> instance);
|
||||||
|
|
||||||
void samplePeakEach(TimeMs peakDuration);
|
void samplePeakEach(TimeMs peakDuration);
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ private:
|
||||||
void ensureSourceCreated();
|
void ensureSourceCreated();
|
||||||
void playWithLooping(bool looping);
|
void playWithLooping(bool looping);
|
||||||
|
|
||||||
gsl::not_null<Instance*> _instance;
|
not_null<Instance*> _instance;
|
||||||
|
|
||||||
bool _failed = false;
|
bool _failed = false;
|
||||||
bool _active = false;
|
bool _active = false;
|
||||||
|
|
|
@ -100,7 +100,7 @@ Reader::Reader(const QString &filepath, Callback &&callback, Mode mode, int64 se
|
||||||
init(FileLocation(filepath), QByteArray());
|
init(FileLocation(filepath), QByteArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
Reader::Reader(gsl::not_null<DocumentData*> document, FullMsgId msgId, Callback &&callback, Mode mode, int64 seekMs)
|
Reader::Reader(not_null<DocumentData*> document, FullMsgId msgId, Callback &&callback, Mode mode, int64 seekMs)
|
||||||
: _callback(std::move(callback))
|
: _callback(std::move(callback))
|
||||||
, _mode(mode)
|
, _mode(mode)
|
||||||
, _audioMsgId(document, msgId, (mode == Mode::Video) ? rand_value<uint32>() : 0)
|
, _audioMsgId(document, msgId, (mode == Mode::Video) ? rand_value<uint32>() : 0)
|
||||||
|
|
|
@ -62,7 +62,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
Reader(const QString &filepath, Callback &&callback, Mode mode = Mode::Gif, TimeMs seekMs = 0);
|
Reader(const QString &filepath, Callback &&callback, Mode mode = Mode::Gif, TimeMs seekMs = 0);
|
||||||
Reader(gsl::not_null<DocumentData*> document, FullMsgId msgId, Callback &&callback, Mode mode = Mode::Gif, TimeMs seekMs = 0);
|
Reader(not_null<DocumentData*> document, FullMsgId msgId, Callback &&callback, Mode mode = Mode::Gif, TimeMs seekMs = 0);
|
||||||
|
|
||||||
static void callback(Reader *reader, int threadIndex, Notification notification); // reader can be deleted
|
static void callback(Reader *reader, int threadIndex, Notification notification); // reader can be deleted
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ public:
|
||||||
finishDrag(false);
|
finishDrag(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void ui_repaintHistoryItem(gsl::not_null<const HistoryItem*> item) {
|
void ui_repaintHistoryItem(not_null<const HistoryItem*> item) {
|
||||||
if (item == _item) {
|
if (item == _item) {
|
||||||
repaintItem();
|
repaintItem();
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@ void ListWidget::mouseMoveEvent(QMouseEvent *e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListWidget::ui_repaintHistoryItem(gsl::not_null<const HistoryItem*> item) {
|
void ListWidget::ui_repaintHistoryItem(not_null<const HistoryItem*> item) {
|
||||||
repaintItem(item);
|
repaintItem(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue