diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index d90c2102e2..7491cbca30 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -49,7 +49,7 @@ constexpr auto kUnreadMentionsNextRequestLimit = 100; } // namespace -ApiWrap::ApiWrap(gsl::not_null session) +ApiWrap::ApiWrap(not_null session) : _session(session) , _messageDataResolveDelayed([this] { resolveMessageDatas(); }) , _webPagesTimer([this] { resolveWebPages(); }) @@ -1462,7 +1462,7 @@ void ApiWrap::updateStickers() { requestSavedGifs(now); } -void ApiWrap::setGroupStickerSet(gsl::not_null megagroup, const MTPInputStickerSet &set) { +void ApiWrap::setGroupStickerSet(not_null megagroup, const MTPInputStickerSet &set) { Expects(megagroup->mgInfo != nullptr); megagroup->mgInfo->stickerSet = set; request(MTPchannels_SetStickers(megagroup->inputChannel, set)).send(); @@ -1720,7 +1720,7 @@ void ApiWrap::applyUpdateNoPtsCheck(const MTPUpdate &update) { } } -void ApiWrap::jumpToDate(gsl::not_null peer, const QDate &date) { +void ApiWrap::jumpToDate(not_null peer, const QDate &date) { // API returns a message with date <= offset_date. // 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. @@ -1762,7 +1762,7 @@ void ApiWrap::jumpToDate(gsl::not_null peer, const QDate &date) { }).send(); } -void ApiWrap::preloadEnoughUnreadMentions(gsl::not_null history) { +void ApiWrap::preloadEnoughUnreadMentions(not_null history) { auto fullCount = history->getUnreadMentionsCount(); auto loadedCount = history->getUnreadMentionsLoadedCount(); auto allLoaded = (fullCount >= 0) ? (loadedCount >= fullCount) : false; @@ -1798,7 +1798,7 @@ void ApiWrap::checkForUnreadMentions(const base::flat_set &possiblyReadMe } } -void ApiWrap::cancelEditChatAdmins(gsl::not_null chat) { +void ApiWrap::cancelEditChatAdmins(not_null chat) { _chatAdminsEnabledRequests.take(chat) | requestCanceller(); @@ -1809,9 +1809,9 @@ void ApiWrap::cancelEditChatAdmins(gsl::not_null chat) { } void ApiWrap::editChatAdmins( - gsl::not_null chat, + not_null chat, bool adminsEnabled, - base::flat_set> &&admins) { + base::flat_set> &&admins) { cancelEditChatAdmins(chat); if (adminsEnabled) { _chatAdminsToSave.emplace(chat, std::move(admins)); @@ -1830,7 +1830,7 @@ void ApiWrap::editChatAdmins( _chatAdminsEnabledRequests.emplace(chat, requestId); } -void ApiWrap::saveChatAdmins(gsl::not_null chat) { +void ApiWrap::saveChatAdmins(not_null chat) { if (!_chatAdminsToSave.contains(chat)) { return; } @@ -1845,8 +1845,8 @@ void ApiWrap::saveChatAdmins(gsl::not_null chat) { _chatAdminsEnabledRequests.emplace(chat, requestId); } -void ApiWrap::sendSaveChatAdminsRequests(gsl::not_null chat) { - auto editOne = [this, chat](gsl::not_null user, bool admin) { +void ApiWrap::sendSaveChatAdminsRequests(not_null chat) { + auto editOne = [this, chat](not_null user, bool admin) { auto requestId = request(MTPmessages_EditChatAdmin( chat->inputChat, user->inputUser, @@ -1892,7 +1892,7 @@ void ApiWrap::sendSaveChatAdminsRequests(gsl::not_null chat) { t_assert(!!admins); auto toRemove = chat->admins; - auto toAppoint = std::vector>(); + auto toAppoint = std::vector>(); if (!admins->empty()) { toAppoint.reserve(admins->size()); for (auto user : *admins) { diff --git a/Telegram/SourceFiles/apiwrap.h b/Telegram/SourceFiles/apiwrap.h index d3f67da2d1..7b7a94b8fe 100644 --- a/Telegram/SourceFiles/apiwrap.h +++ b/Telegram/SourceFiles/apiwrap.h @@ -42,7 +42,7 @@ inline const MTPVector *getChatsFromMessagesChats(const MTPmessages_Cha class ApiWrap : private MTP::Sender, private base::Subscriber { public: - ApiWrap(gsl::not_null session); + ApiWrap(not_null session); void start(); void applyUpdates(const MTPUpdates &updates, uint64 sentMessageRandomId = 0); @@ -72,7 +72,7 @@ public: void requestStickerSets(); void saveStickerSets(const Stickers::Order &localOrder, const Stickers::Order &localRemoved); void updateStickers(); - void setGroupStickerSet(gsl::not_null megagroup, const MTPInputStickerSet &set); + void setGroupStickerSet(not_null megagroup, const MTPInputStickerSet &set); void joinChannel(ChannelData *channel); void leaveChannel(ChannelData *channel); @@ -98,15 +98,15 @@ public: void applyUpdatesNoPtsCheck(const MTPUpdates &updates); void applyUpdateNoPtsCheck(const MTPUpdate &update); - void jumpToDate(gsl::not_null peer, const QDate &date); + void jumpToDate(not_null peer, const QDate &date); - void preloadEnoughUnreadMentions(gsl::not_null history); + void preloadEnoughUnreadMentions(not_null history); void checkForUnreadMentions(const base::flat_set &possiblyReadMentions, ChannelData *channel = nullptr); void editChatAdmins( - gsl::not_null chat, + not_null chat, bool adminsEnabled, - base::flat_set> &&admins); + base::flat_set> &&admins); ~ApiWrap(); @@ -149,11 +149,11 @@ private: void requestFeaturedStickers(TimeId now); void requestSavedGifs(TimeId now); - void cancelEditChatAdmins(gsl::not_null chat); - void saveChatAdmins(gsl::not_null chat); - void sendSaveChatAdminsRequests(gsl::not_null chat); + void cancelEditChatAdmins(not_null chat); + void saveChatAdmins(not_null chat); + void sendSaveChatAdminsRequests(not_null chat); - gsl::not_null _session; + not_null _session; mtpRequestId _changelogSubscription = 0; MessageDataRequests _messageDataRequests; @@ -203,11 +203,11 @@ private: mtpRequestId _contactsStatusesRequestId = 0; - base::flat_map, mtpRequestId> _unreadMentionsRequests; + base::flat_map, mtpRequestId> _unreadMentionsRequests; - base::flat_map, mtpRequestId> _chatAdminsEnabledRequests; - base::flat_map, base::flat_set>> _chatAdminsToSave; - base::flat_map, base::flat_set> _chatAdminsSaveRequests; + base::flat_map, mtpRequestId> _chatAdminsEnabledRequests; + base::flat_map, base::flat_set>> _chatAdminsToSave; + base::flat_map, base::flat_set> _chatAdminsSaveRequests; base::Observable _fullPeerUpdated; diff --git a/Telegram/SourceFiles/auth_session.h b/Telegram/SourceFiles/auth_session.h index a11f4012b0..3124a26b34 100644 --- a/Telegram/SourceFiles/auth_session.h +++ b/Telegram/SourceFiles/auth_session.h @@ -61,18 +61,18 @@ public: base::Observable &savedGifsUpdated() { return _savedGifsUpdated; } - base::Observable> &historyCleared() { + base::Observable> &historyCleared() { return _historyCleared; } - base::Observable> &repaintLogEntry() { + base::Observable> &repaintLogEntry() { return _repaintLogEntry; } base::Observable &pendingHistoryResize() { return _pendingHistoryResize; } struct ItemVisibilityQuery { - gsl::not_null item; - gsl::not_null isVisible; + not_null item; + not_null isVisible; }; base::Observable &queryItemVisibility() { return _queryItemVisibility; @@ -162,8 +162,8 @@ private: base::Observable _moreChatsLoaded; base::Observable _stickersUpdated; base::Observable _savedGifsUpdated; - base::Observable> _historyCleared; - base::Observable> _repaintLogEntry; + base::Observable> _historyCleared; + base::Observable> _repaintLogEntry; base::Observable _pendingHistoryResize; base::Observable _queryItemVisibility; Variables _variables; diff --git a/Telegram/SourceFiles/boxes/add_contact_box.cpp b/Telegram/SourceFiles/boxes/add_contact_box.cpp index 97741955f1..3905a52b8d 100644 --- a/Telegram/SourceFiles/boxes/add_contact_box.cpp +++ b/Telegram/SourceFiles/boxes/add_contact_box.cpp @@ -78,10 +78,10 @@ protected: private: struct ChatRow { - ChatRow(gsl::not_null peer) : peer(peer) { + ChatRow(not_null peer) : peer(peer) { } - gsl::not_null peer; + not_null peer; Text name, status; }; void paintChat(Painter &p, const ChatRow &row, bool selected) const; @@ -390,7 +390,7 @@ void GroupInfoBox::onNameSubmit() { } } -void GroupInfoBox::createGroup(gsl::not_null selectUsersBox, const QString &title, const std::vector> &users) { +void GroupInfoBox::createGroup(not_null selectUsersBox, const QString &title, const std::vector> &users) { if (_creationRequestId) return; auto inputs = QVector(); @@ -426,7 +426,7 @@ void GroupInfoBox::createGroup(gsl::not_null selectUsersBox, const | [](auto chats) { return App::chat(chats->front().c_chat().vid.v); } - | [this](gsl::not_null chat) { + | [this](not_null chat) { if (!_photoImage.isNull()) { Messenger::Instance().uploadProfilePhoto(_photoImage, chat->id); } @@ -465,7 +465,7 @@ void GroupInfoBox::onNext() { if (_creating != CreatingGroupGroup) { createChannel(title, description); } else { - auto initBox = [title, weak = weak(this)](gsl::not_null box) { + auto initBox = [title, weak = weak(this)](not_null box) { box->addButton(langFactory(lng_create_group_create), [box, title, weak] { if (weak) { auto rows = box->peerListCollectSelectedRows(); @@ -505,7 +505,7 @@ void GroupInfoBox::createChannel(const QString &title, const QString &descriptio | [](auto chats) { return App::channel(chats->front().c_channel().vid.v); } - | [this](gsl::not_null channel) { + | [this](not_null channel) { if (!_photoImage.isNull()) { Messenger::Instance().uploadProfilePhoto( _photoImage, @@ -909,7 +909,7 @@ bool SetupChannelBox::onFirstCheckFail(const RPCError &error) { return true; } -EditNameTitleBox::EditNameTitleBox(QWidget*, gsl::not_null peer) +EditNameTitleBox::EditNameTitleBox(QWidget*, not_null 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) , _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(); } -EditBioBox::EditBioBox(QWidget*, gsl::not_null self) : BoxContent() +EditBioBox::EditBioBox(QWidget*, not_null self) : BoxContent() , _dynamicFieldStyle(CreateBioFieldStyle()) , _self(self) , _bio(this, _dynamicFieldStyle, langFactory(lng_bio_placeholder), _self->about()) @@ -1134,7 +1134,7 @@ void EditBioBox::save() { }).send(); } -EditChannelBox::EditChannelBox(QWidget*, gsl::not_null channel) +EditChannelBox::EditChannelBox(QWidget*, not_null channel) : _channel(channel) , _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()) diff --git a/Telegram/SourceFiles/boxes/add_contact_box.h b/Telegram/SourceFiles/boxes/add_contact_box.h index f52db5d21c..c49e8f14f6 100644 --- a/Telegram/SourceFiles/boxes/add_contact_box.h +++ b/Telegram/SourceFiles/boxes/add_contact_box.h @@ -116,7 +116,7 @@ private slots: private: void setupPhotoButton(); void createChannel(const QString &title, const QString &description); - void createGroup(gsl::not_null selectUsersBox, const QString &title, const std::vector> &users); + void createGroup(not_null selectUsersBox, const QString &title, const std::vector> &users); void updateMaxHeight(); void updateSelected(const QPoint &cursorGlobalPosition); @@ -206,7 +206,7 @@ class EditNameTitleBox : public BoxContent, public RPCSender { Q_OBJECT public: - EditNameTitleBox(QWidget*, gsl::not_null peer); + EditNameTitleBox(QWidget*, not_null peer); protected: void setInnerFocus() override; @@ -225,7 +225,7 @@ private: void onSaveChatDone(const MTPUpdates &updates); bool onSaveChatFail(const RPCError &e); - gsl::not_null _peer; + not_null _peer; object_ptr _first; object_ptr _last; @@ -239,7 +239,7 @@ private: class EditBioBox : public BoxContent, private MTP::Sender { public: - EditBioBox(QWidget*, gsl::not_null self); + EditBioBox(QWidget*, not_null self); protected: void setInnerFocus() override; @@ -253,7 +253,7 @@ private: void save(); style::InputField _dynamicFieldStyle; - gsl::not_null _self; + not_null _self; object_ptr _bio; object_ptr _countdown; @@ -267,7 +267,7 @@ class EditChannelBox : public BoxContent, public RPCSender { Q_OBJECT public: - EditChannelBox(QWidget*, gsl::not_null channel); + EditChannelBox(QWidget*, not_null channel); protected: void prepare() override; @@ -301,7 +301,7 @@ private: void saveSign(); void saveInvites(); - gsl::not_null _channel; + not_null _channel; object_ptr _title; object_ptr _description; diff --git a/Telegram/SourceFiles/boxes/confirm_box.cpp b/Telegram/SourceFiles/boxes/confirm_box.cpp index 0d2a297cec..eedeb4bcf2 100644 --- a/Telegram/SourceFiles/boxes/confirm_box.cpp +++ b/Telegram/SourceFiles/boxes/confirm_box.cpp @@ -216,7 +216,7 @@ InformBox::InformBox(QWidget*, const QString &text, base::lambda closedC InformBox::InformBox(QWidget*, const QString &text, const QString &doneText, base::lambda closedCallback) : ConfirmBox(ConfirmBox::InformBoxTag(), text, doneText, std::move(closedCallback)) { } -MaxInviteBox::MaxInviteBox(QWidget*, gsl::not_null channel) : BoxContent() +MaxInviteBox::MaxInviteBox(QWidget*, not_null channel) : BoxContent() , _channel(channel) , _text(st::boxLabelStyle, lng_participant_invite_sorry(lt_count, Global::ChatSizeMax()), _confirmBoxTextOptions, st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right()) { } diff --git a/Telegram/SourceFiles/boxes/confirm_box.h b/Telegram/SourceFiles/boxes/confirm_box.h index 4637e82494..9ea2e457a2 100644 --- a/Telegram/SourceFiles/boxes/confirm_box.h +++ b/Telegram/SourceFiles/boxes/confirm_box.h @@ -98,7 +98,7 @@ public: class MaxInviteBox : public BoxContent { public: - MaxInviteBox(QWidget*, gsl::not_null channel); + MaxInviteBox(QWidget*, not_null channel); protected: void prepare() override; @@ -112,7 +112,7 @@ protected: private: void updateSelected(const QPoint &cursorGlobalPosition); - gsl::not_null _channel; + not_null _channel; Text _text; int32 _textWidth, _textHeight; diff --git a/Telegram/SourceFiles/boxes/edit_participant_box.cpp b/Telegram/SourceFiles/boxes/edit_participant_box.cpp index 334d7ac165..589adbf0f4 100644 --- a/Telegram/SourceFiles/boxes/edit_participant_box.cpp +++ b/Telegram/SourceFiles/boxes/edit_participant_box.cpp @@ -75,7 +75,7 @@ void ApplyDependencies(CheckboxesMap &checkboxes, DependenciesMap &dependencies, class EditParticipantBox::Inner : public TWidget { public: - Inner(QWidget *parent, gsl::not_null channel, gsl::not_null user, bool hasAdminRights); + Inner(QWidget *parent, not_null channel, not_null user, bool hasAdminRights); template QPointer addControl(object_ptr widget, QMargins margin) { @@ -92,8 +92,8 @@ protected: private: void doAddControl(object_ptr widget, QMargins margin); - gsl::not_null _channel; - gsl::not_null _user; + not_null _channel; + not_null _user; object_ptr _userPhoto; Text _userName; bool _hasAdminRights = false; @@ -105,7 +105,7 @@ private: }; -EditParticipantBox::Inner::Inner(QWidget *parent, gsl::not_null channel, gsl::not_null user, bool hasAdminRights) : TWidget(parent) +EditParticipantBox::Inner::Inner(QWidget *parent, not_null channel, not_null user, bool hasAdminRights) : TWidget(parent) , _channel(channel) , _user(user) , _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()); } -EditParticipantBox::EditParticipantBox(QWidget*, gsl::not_null channel, gsl::not_null user, bool hasAdminRights) : BoxContent() +EditParticipantBox::EditParticipantBox(QWidget*, not_null channel, not_null user, bool hasAdminRights) : BoxContent() , _channel(channel) , _user(user) , _hasAdminRights(hasAdminRights) { @@ -189,7 +189,7 @@ void EditParticipantBox::resizeToContent() { setDimensions(_inner->width(), qMin(_inner->height(), st::boxMaxListHeight)); } -EditAdminBox::EditAdminBox(QWidget*, gsl::not_null channel, gsl::not_null user, const MTPChannelAdminRights &rights) : EditParticipantBox(nullptr, channel, user, (rights.c_channelAdminRights().vflags.v != 0)) +EditAdminBox::EditAdminBox(QWidget*, not_null channel, not_null user, const MTPChannelAdminRights &rights) : EditParticipantBox(nullptr, channel, user, (rights.c_channelAdminRights().vflags.v != 0)) , _oldRights(rights) { auto dependency = [this](Flag dependent, Flag dependency) { _dependencies.push_back(std::make_pair(dependent, dependency)); @@ -198,7 +198,7 @@ EditAdminBox::EditAdminBox(QWidget*, gsl::not_null channel, gsl::n dependency(Flag::f_invite_users, Flag::f_invite_link); } -MTPChannelAdminRights EditAdminBox::DefaultRights(gsl::not_null channel) { +MTPChannelAdminRights EditAdminBox::DefaultRights(not_null channel) { 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_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(); } -EditRestrictedBox::EditRestrictedBox(QWidget*, gsl::not_null channel, gsl::not_null user, bool hasAdminRights, const MTPChannelBannedRights &rights) : EditParticipantBox(nullptr, channel, user, hasAdminRights) +EditRestrictedBox::EditRestrictedBox(QWidget*, not_null channel, not_null user, bool hasAdminRights, const MTPChannelBannedRights &rights) : EditParticipantBox(nullptr, channel, user, hasAdminRights) , _oldRights(rights) { auto dependency = [this](Flag dependent, Flag dependency) { _dependencies.push_back(std::make_pair(dependent, dependency)); @@ -391,7 +391,7 @@ void EditRestrictedBox::applyDependencies(QPointer changed) { ApplyDependencies(_checkboxes, _dependencies, changed); } -MTPChannelBannedRights EditRestrictedBox::DefaultRights(gsl::not_null channel) { +MTPChannelBannedRights EditRestrictedBox::DefaultRights(not_null 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; return MTP_channelBannedRights(MTP_flags(defaultRights), MTP_int(0)); } diff --git a/Telegram/SourceFiles/boxes/edit_participant_box.h b/Telegram/SourceFiles/boxes/edit_participant_box.h index ca5edd0206..d4496b19b4 100644 --- a/Telegram/SourceFiles/boxes/edit_participant_box.h +++ b/Telegram/SourceFiles/boxes/edit_participant_box.h @@ -34,17 +34,17 @@ class CalendarBox; class EditParticipantBox : public BoxContent { public: - EditParticipantBox(QWidget*, gsl::not_null channel, gsl::not_null user, bool hasAdminRights); + EditParticipantBox(QWidget*, not_null channel, not_null user, bool hasAdminRights); protected: void prepare() override; void resizeToContent(); - gsl::not_null user() const { + not_null user() const { return _user; } - gsl::not_null channel() const { + not_null channel() const { return _channel; } @@ -58,8 +58,8 @@ protected: } private: - gsl::not_null _channel; - gsl::not_null _user; + not_null _channel; + not_null _user; bool _hasAdminRights = false; class Inner; @@ -69,7 +69,7 @@ private: class EditAdminBox : public EditParticipantBox { public: - EditAdminBox(QWidget*, gsl::not_null channel, gsl::not_null user, const MTPChannelAdminRights &rights); + EditAdminBox(QWidget*, not_null channel, not_null user, const MTPChannelAdminRights &rights); void setSaveCallback(base::lambda callback) { _saveCallback = std::move(callback); @@ -82,7 +82,7 @@ private: using Flag = MTPDchannelAdminRights::Flag; using Flags = MTPDchannelAdminRights::Flags; - static MTPChannelAdminRights DefaultRights(gsl::not_null channel); + static MTPChannelAdminRights DefaultRights(not_null channel); bool canSave() const { return !!_saveCallback; @@ -104,7 +104,7 @@ private: class EditRestrictedBox : public EditParticipantBox { public: - EditRestrictedBox(QWidget*, gsl::not_null channel, gsl::not_null user, bool hasAdminRights, const MTPChannelBannedRights &rights); + EditRestrictedBox(QWidget*, not_null channel, not_null user, bool hasAdminRights, const MTPChannelBannedRights &rights); void setSaveCallback(base::lambda callback) { _saveCallback = std::move(callback); @@ -117,7 +117,7 @@ private: using Flag = MTPDchannelBannedRights::Flag; using Flags = MTPDchannelBannedRights::Flags; - static MTPChannelBannedRights DefaultRights(gsl::not_null channel); + static MTPChannelBannedRights DefaultRights(not_null channel); bool canSave() const { return !!_saveCallback; diff --git a/Telegram/SourceFiles/boxes/edit_privacy_box.cpp b/Telegram/SourceFiles/boxes/edit_privacy_box.cpp index 3233d305f5..a9137d2f63 100644 --- a/Telegram/SourceFiles/boxes/edit_privacy_box.cpp +++ b/Telegram/SourceFiles/boxes/edit_privacy_box.cpp @@ -34,22 +34,22 @@ namespace { class PrivacyExceptionsBoxController : public ChatsListBoxController { public: - PrivacyExceptionsBoxController(base::lambda titleFactory, const std::vector> &selected); - void rowClicked(gsl::not_null row) override; + PrivacyExceptionsBoxController(base::lambda titleFactory, const std::vector> &selected); + void rowClicked(not_null row) override; - std::vector> getResult() const; + std::vector> getResult() const; protected: void prepareViewHook() override; - std::unique_ptr createRow(gsl::not_null history) override; + std::unique_ptr createRow(not_null history) override; private: base::lambda _titleFactory; - std::vector> _selected; + std::vector> _selected; }; -PrivacyExceptionsBoxController::PrivacyExceptionsBoxController(base::lambda titleFactory, const std::vector> &selected) +PrivacyExceptionsBoxController::PrivacyExceptionsBoxController(base::lambda titleFactory, const std::vector> &selected) : _titleFactory(std::move(titleFactory)) , _selected(selected) { } @@ -59,9 +59,9 @@ void PrivacyExceptionsBoxController::prepareViewHook() { delegate()->peerListAddSelectedRows(_selected); } -std::vector> PrivacyExceptionsBoxController::getResult() const { +std::vector> PrivacyExceptionsBoxController::getResult() const { auto peers = delegate()->peerListCollectSelectedRows(); - auto users = std::vector>(); + auto users = std::vector>(); if (!peers.empty()) { users.reserve(peers.size()); for_const (auto peer, peers) { @@ -73,11 +73,11 @@ std::vector> PrivacyExceptionsBoxController::getResult( return users; } -void PrivacyExceptionsBoxController::rowClicked(gsl::not_null row) { +void PrivacyExceptionsBoxController::rowClicked(not_null row) { delegate()->peerListSetRowChecked(row, !row->checked()); } -std::unique_ptr PrivacyExceptionsBoxController::createRow(gsl::not_null history) { +std::unique_ptr PrivacyExceptionsBoxController::createRow(not_null history) { if (history->peer->isSelf()) { return nullptr; } @@ -178,7 +178,7 @@ void EditPrivacyBox::editExceptionUsers(Exception exception) { auto controller = std::make_unique(base::lambda_guarded(this, [this, exception] { return _controller->exceptionBoxTitle(exception); }), exceptionUsers(exception)); - auto initBox = [this, exception, controller = controller.get()](gsl::not_null box) { + auto initBox = [this, exception, controller = controller.get()](not_null box) { box->addButton(langFactory(lng_settings_save), base::lambda_guarded(this, [this, box, exception, controller] { exceptionUsers(exception) = controller->getResult(); exceptionLink(exception)->entity()->setText(exceptionLinkText(exception)); @@ -244,7 +244,7 @@ style::margins EditPrivacyBox::exceptionLinkMargins() const { return st::editPrivacyLinkMargin; } -std::vector> &EditPrivacyBox::exceptionUsers(Exception exception) { +std::vector> &EditPrivacyBox::exceptionUsers(Exception exception) { switch (exception) { case Exception::Always: return _alwaysUsers; case Exception::Never: return _neverUsers; diff --git a/Telegram/SourceFiles/boxes/edit_privacy_box.h b/Telegram/SourceFiles/boxes/edit_privacy_box.h index 0d54281158..46eaae29f4 100644 --- a/Telegram/SourceFiles/boxes/edit_privacy_box.h +++ b/Telegram/SourceFiles/boxes/edit_privacy_box.h @@ -102,7 +102,7 @@ private: void editExceptionUsers(Exception exception); QString exceptionLinkText(Exception exception); - std::vector> &exceptionUsers(Exception exception); + std::vector> &exceptionUsers(Exception exception); object_ptr> &exceptionLink(Exception exception); std::unique_ptr _controller; @@ -120,7 +120,7 @@ private: object_ptr> _neverLink = { nullptr }; object_ptr _exceptionsDescription = { nullptr }; - std::vector> _alwaysUsers; - std::vector> _neverUsers; + std::vector> _alwaysUsers; + std::vector> _neverUsers; }; diff --git a/Telegram/SourceFiles/boxes/language_box.cpp b/Telegram/SourceFiles/boxes/language_box.cpp index 084b4dc075..42c2f789f9 100644 --- a/Telegram/SourceFiles/boxes/language_box.cpp +++ b/Telegram/SourceFiles/boxes/language_box.cpp @@ -33,7 +33,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org class LanguageBox::Inner : public TWidget, private base::Subscriber { public: - Inner(QWidget *parent, gsl::not_null languages); + Inner(QWidget *parent, not_null languages); void setSelected(int index); void refresh(); @@ -42,13 +42,13 @@ private: void activateCurrent(); void languageChanged(int languageIndex); - gsl::not_null _languages; + not_null _languages; std::shared_ptr _group; std::vector> _buttons; }; -LanguageBox::Inner::Inner(QWidget *parent, gsl::not_null languages) : TWidget(parent) +LanguageBox::Inner::Inner(QWidget *parent, not_null languages) : TWidget(parent) , _languages(languages) { _group = std::make_shared(0); _group->setChangedCallback([this](int value) { languageChanged(value); }); diff --git a/Telegram/SourceFiles/boxes/mute_settings_box.h b/Telegram/SourceFiles/boxes/mute_settings_box.h index 8749872713..dc689b1fb6 100644 --- a/Telegram/SourceFiles/boxes/mute_settings_box.h +++ b/Telegram/SourceFiles/boxes/mute_settings_box.h @@ -15,7 +15,7 @@ class MuteSettingsBox : public BoxContent { Q_OBJECT public: - MuteSettingsBox(QWidget *parent, gsl::not_null peer) + MuteSettingsBox(QWidget *parent, not_null peer) : _peer(peer) { } @@ -23,6 +23,6 @@ class MuteSettingsBox : public BoxContent { void prepare() override; private: - gsl::not_null _peer; + not_null _peer; }; // vi: ts=4 tw=80 diff --git a/Telegram/SourceFiles/boxes/peer_list_box.cpp b/Telegram/SourceFiles/boxes/peer_list_box.cpp index 960770b674..9afaf48960 100644 --- a/Telegram/SourceFiles/boxes/peer_list_box.cpp +++ b/Telegram/SourceFiles/boxes/peer_list_box.cpp @@ -34,7 +34,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org #include "storage/file_download.h" #include "window/themes/window_theme.h" -PeerListBox::PeerListBox(QWidget*, std::unique_ptr controller, base::lambda)> init) +PeerListBox::PeerListBox(QWidget*, std::unique_ptr controller, base::lambda)> init) : _controller(std::move(controller)) , _init(std::move(init)) { Expects(_controller != nullptr); @@ -155,7 +155,7 @@ void PeerListBox::peerListAppendSearchRow(std::unique_ptr row) { _inner->appendSearchRow(std::move(row)); } -void PeerListBox::peerListAppendFoundRow(gsl::not_null row) { +void PeerListBox::peerListAppendFoundRow(not_null row) { _inner->appendFoundRow(row); } @@ -163,7 +163,7 @@ void PeerListBox::peerListPrependRow(std::unique_ptr row) { _inner->prependRow(std::move(row)); } -void PeerListBox::peerListPrependRowFromSearchResult(gsl::not_null row) { +void PeerListBox::peerListPrependRowFromSearchResult(not_null row) { _inner->prependRowFromSearchResult(row); } @@ -171,19 +171,19 @@ PeerListRow *PeerListBox::peerListFindRow(PeerListRowId id) { return _inner->findRow(id); } -void PeerListBox::peerListUpdateRow(gsl::not_null row) { +void PeerListBox::peerListUpdateRow(not_null row) { _inner->updateRow(row); } -void PeerListBox::peerListRemoveRow(gsl::not_null row) { +void PeerListBox::peerListRemoveRow(not_null row) { _inner->removeRow(row); } -void PeerListBox::peerListConvertRowToSearchResult(gsl::not_null row) { +void PeerListBox::peerListConvertRowToSearchResult(not_null row) { _inner->convertRowToSearchResult(row); } -void PeerListBox::peerListSetRowChecked(gsl::not_null row, bool checked) { +void PeerListBox::peerListSetRowChecked(not_null row, bool checked) { auto peer = row->peer(); if (checked) { addSelectItem(peer, PeerListRow::SetStyle::Animated); @@ -203,7 +203,7 @@ int PeerListBox::peerListFullRowsCount() { return _inner->fullRowsCount(); } -gsl::not_null PeerListBox::peerListRowAt(int index) { +not_null PeerListBox::peerListRowAt(int index) { return _inner->rowAt(index); } @@ -276,7 +276,7 @@ void PeerListController::search(const QString &query) { _searchController->searchQuery(query); } -void PeerListController::peerListSearchAddRow(gsl::not_null peer) { +void PeerListController::peerListSearchAddRow(not_null peer) { if (auto row = delegate()->peerListFindRow(peer->id)) { t_assert(row->id() == row->peer()->id); delegate()->peerListAppendFoundRow(row); @@ -314,7 +314,7 @@ void PeerListController::setSearchNoResultsText(const QString &text) { } } -void PeerListBox::addSelectItem(gsl::not_null peer, PeerListRow::SetStyle style) { +void PeerListBox::addSelectItem(not_null peer, PeerListRow::SetStyle style) { if (!_select) { createMultiSelect(); _select->toggleFast(false); @@ -331,7 +331,7 @@ void PeerListBox::peerListFinishSelectedRowsBunch() { _select->entity()->finishItemsBunch(); } -bool PeerListBox::peerListIsRowSelected(gsl::not_null peer) { +bool PeerListBox::peerListIsRowSelected(not_null peer) { return _select ? _select->entity()->hasItem(peer->id) : false; } @@ -340,9 +340,9 @@ int PeerListBox::peerListSelectedRowsCount() { return _select->entity()->getItemsCount(); } -std::vector> PeerListBox::peerListCollectSelectedRows() { +std::vector> PeerListBox::peerListCollectSelectedRows() { Expects(_select != nullptr); - auto result = std::vector>(); + auto result = std::vector>(); auto items = _select->entity()->getItems(); if (!items.empty()) { result.reserve(items.size()); @@ -353,10 +353,10 @@ std::vector> PeerListBox::peerListCollectSelectedRows() return result; } -PeerListRow::PeerListRow(gsl::not_null peer) : PeerListRow(peer, peer->id) { +PeerListRow::PeerListRow(not_null peer) : PeerListRow(peer, peer->id) { } -PeerListRow::PeerListRow(gsl::not_null peer, PeerListRowId id) +PeerListRow::PeerListRow(not_null peer, PeerListRowId id) : _id(id) , _peer(peer) , _initialized(false) @@ -522,7 +522,7 @@ void PeerListRow::setCheckedInternal(bool checked, SetStyle style) { _checkbox->setChecked(checked, speed); } -PeerListBox::Inner::Inner(QWidget *parent, gsl::not_null controller) : TWidget(parent) +PeerListBox::Inner::Inner(QWidget *parent, not_null controller) : TWidget(parent) , _controller(controller) , _rowHeight(st::contactsPadding.top() + st::contactsPhotoSize + st::contactsPadding.bottom()) { subscribe(Auth().downloaderTaskFinished(), [this] { update(); }); @@ -564,7 +564,7 @@ void PeerListBox::Inner::appendSearchRow(std::unique_ptr row) { } } -void PeerListBox::Inner::appendFoundRow(gsl::not_null row) { +void PeerListBox::Inner::appendFoundRow(not_null row) { Expects(showingSearch()); auto index = findRowIndex(row); if (index.value < 0) { @@ -572,13 +572,13 @@ void PeerListBox::Inner::appendFoundRow(gsl::not_null row) { } } -void PeerListBox::Inner::changeCheckState(gsl::not_null row, bool checked, PeerListRow::SetStyle style) { +void PeerListBox::Inner::changeCheckState(not_null row, bool checked, PeerListRow::SetStyle style) { row->setChecked(checked, style, [this, row] { updateRow(row); }); } -void PeerListBox::Inner::addRowEntry(gsl::not_null row) { +void PeerListBox::Inner::addRowEntry(not_null row) { _rowsById.emplace(row->id(), row); _rowsByPeer[row->peer()].push_back(row); if (addingToSearchIndex()) { @@ -601,7 +601,7 @@ bool PeerListBox::Inner::addingToSearchIndex() const { return (_searchMode != PeerListSearchMode::Disabled) || !_searchIndex.empty(); } -void PeerListBox::Inner::addToSearchIndex(gsl::not_null row) { +void PeerListBox::Inner::addToSearchIndex(not_null row) { if (row->isSearchResult()) { return; } @@ -613,7 +613,7 @@ void PeerListBox::Inner::addToSearchIndex(gsl::not_null row) { } } -void PeerListBox::Inner::removeFromSearchIndex(gsl::not_null row) { +void PeerListBox::Inner::removeFromSearchIndex(not_null row) { auto &nameFirstChars = row->nameFirstChars(); if (!nameFirstChars.empty()) { for_const (auto ch, row->nameFirstChars()) { @@ -639,7 +639,7 @@ void PeerListBox::Inner::prependRow(std::unique_ptr row) { } } -void PeerListBox::Inner::prependRowFromSearchResult(gsl::not_null row) { +void PeerListBox::Inner::prependRowFromSearchResult(not_null row) { if (!row->isSearchResult()) { return; } @@ -677,7 +677,7 @@ PeerListRow *PeerListBox::Inner::findRow(PeerListRowId id) { return (it == _rowsById.cend()) ? nullptr : it->second.get(); } -void PeerListBox::Inner::removeRow(gsl::not_null row) { +void PeerListBox::Inner::removeRow(not_null row) { auto index = row->absoluteIndex(); auto isSearchResult = row->isSearchResult(); auto &eraseFrom = isSearchResult ? _searchRows : _rows; @@ -698,7 +698,7 @@ void PeerListBox::Inner::removeRow(gsl::not_null row) { restoreSelection(); } -void PeerListBox::Inner::convertRowToSearchResult(gsl::not_null row) { +void PeerListBox::Inner::convertRowToSearchResult(not_null row) { if (row->isSearchResult()) { return; } else if (!showingSearch() || !_controller->hasComplexSearch()) { @@ -719,7 +719,7 @@ int PeerListBox::Inner::fullRowsCount() const { return _rows.size(); } -gsl::not_null PeerListBox::Inner::rowAt(int index) const { +not_null PeerListBox::Inner::rowAt(int index) const { Expects(index >= 0 && index < _rows.size()); return _rows[index].get(); } @@ -1001,7 +1001,7 @@ void PeerListBox::Inner::selectSkip(int direction) { auto rowsCount = shownRowsCount(); auto index = 0; auto firstEnabled = -1, lastEnabled = -1; - enumerateShownRows([&firstEnabled, &lastEnabled, &index](gsl::not_null row) { + enumerateShownRows([&firstEnabled, &lastEnabled, &index](not_null row) { if (!row->disabled()) { if (firstEnabled < 0) { firstEnabled = index; @@ -1098,7 +1098,7 @@ void PeerListBox::Inner::searchQueryChanged(QString query) { if (_normalizedSearchQuery != normalizedQuery) { setSearchQuery(query, normalizedQuery); if (_controller->searchInLocal() && !searchWordsList.isEmpty()) { - auto minimalList = (const std::vector>*)nullptr; + auto minimalList = (const std::vector>*)nullptr; for_const (auto &searchWord, searchWordsList) { auto searchWordStart = searchWord[0].toLower(); auto it = _searchIndex.find(searchWordStart); @@ -1202,7 +1202,7 @@ void PeerListBox::Inner::updateSelection() { setSelected(selected); } -QRect PeerListBox::Inner::getActionRect(gsl::not_null row, RowIndex index) const { +QRect PeerListBox::Inner::getActionRect(not_null row, RowIndex index) const { auto actionSize = row->actionSize(); if (actionSize.isEmpty()) { return QRect(); @@ -1226,7 +1226,7 @@ int PeerListBox::Inner::getRowTop(RowIndex index) const { return -1; } -void PeerListBox::Inner::updateRow(gsl::not_null row, RowIndex hint) { +void PeerListBox::Inner::updateRow(not_null row, RowIndex hint) { updateRow(findRowIndex(row, hint)); } @@ -1286,7 +1286,7 @@ PeerListRow *PeerListBox::Inner::getRow(RowIndex index) { return nullptr; } -PeerListBox::Inner::RowIndex PeerListBox::Inner::findRowIndex(gsl::not_null row, RowIndex hint) { +PeerListBox::Inner::RowIndex PeerListBox::Inner::findRowIndex(not_null row, RowIndex hint) { if (!showingSearch()) { t_assert(!row->isSearchResult()); return RowIndex(row->absoluteIndex()); diff --git a/Telegram/SourceFiles/boxes/peer_list_box.h b/Telegram/SourceFiles/boxes/peer_list_box.h index 801106be1d..394ba00889 100644 --- a/Telegram/SourceFiles/boxes/peer_list_box.h +++ b/Telegram/SourceFiles/boxes/peer_list_box.h @@ -46,8 +46,8 @@ inline auto PaintUserpicCallback(PeerData *peer) { using PeerListRowId = uint64; class PeerListRow { public: - PeerListRow(gsl::not_null peer); - PeerListRow(gsl::not_null peer, PeerListRowId id); + PeerListRow(not_null peer); + PeerListRow(not_null peer, PeerListRowId id); enum class State { Active, @@ -64,7 +64,7 @@ public: // added to the box it is always false. bool checked() const; - gsl::not_null peer() const { + not_null peer() const { return _peer; } PeerListRowId id() const { @@ -163,7 +163,7 @@ private: void setStatusText(const QString &text); PeerListRowId _id = 0; - gsl::not_null _peer; + not_null _peer; std::unique_ptr _ripple; std::unique_ptr _checkbox; Text _name; @@ -193,15 +193,15 @@ public: virtual void peerListSetSearchMode(PeerListSearchMode mode) = 0; virtual void peerListAppendRow(std::unique_ptr row) = 0; virtual void peerListAppendSearchRow(std::unique_ptr row) = 0; - virtual void peerListAppendFoundRow(gsl::not_null row) = 0; + virtual void peerListAppendFoundRow(not_null row) = 0; virtual void peerListPrependRow(std::unique_ptr row) = 0; - virtual void peerListPrependRowFromSearchResult(gsl::not_null row) = 0; - virtual void peerListUpdateRow(gsl::not_null row) = 0; - virtual void peerListRemoveRow(gsl::not_null row) = 0; - virtual void peerListConvertRowToSearchResult(gsl::not_null row) = 0; - virtual bool peerListIsRowSelected(gsl::not_null peer) = 0; - virtual void peerListSetRowChecked(gsl::not_null row, bool checked) = 0; - virtual gsl::not_null peerListRowAt(int index) = 0; + virtual void peerListPrependRowFromSearchResult(not_null row) = 0; + virtual void peerListUpdateRow(not_null row) = 0; + virtual void peerListRemoveRow(not_null row) = 0; + virtual void peerListConvertRowToSearchResult(not_null row) = 0; + virtual bool peerListIsRowSelected(not_null peer) = 0; + virtual void peerListSetRowChecked(not_null row, bool checked) = 0; + virtual not_null peerListRowAt(int index) = 0; virtual void peerListRefreshRows() = 0; virtual void peerListScrollToTop() = 0; virtual int peerListFullRowsCount() = 0; @@ -218,18 +218,18 @@ public: } virtual int peerListSelectedRowsCount() = 0; - virtual std::vector> peerListCollectSelectedRows() = 0; + virtual std::vector> peerListCollectSelectedRows() = 0; virtual ~PeerListDelegate() = default; private: - virtual void peerListAddSelectedRowInBunch(gsl::not_null peer) = 0; + virtual void peerListAddSelectedRowInBunch(not_null peer) = 0; virtual void peerListFinishSelectedRowsBunch() = 0; }; class PeerListSearchDelegate { public: - virtual void peerListSearchAddRow(gsl::not_null peer) = 0; + virtual void peerListSearchAddRow(not_null peer) = 0; virtual void peerListSearchRefreshRows() = 0; virtual ~PeerListSearchDelegate() = default; @@ -242,12 +242,12 @@ public: virtual bool loadMoreRows() = 0; virtual ~PeerListSearchController() = default; - void setDelegate(gsl::not_null delegate) { + void setDelegate(not_null delegate) { _delegate = delegate; } protected: - gsl::not_null delegate() const { + not_null delegate() const { return _delegate; } @@ -261,27 +261,27 @@ public: // Search works only with RowId == peer->id. PeerListController(std::unique_ptr searchController = nullptr); - void setDelegate(gsl::not_null delegate) { + void setDelegate(not_null delegate) { _delegate = delegate; prepare(); } virtual void prepare() = 0; - virtual void rowClicked(gsl::not_null row) = 0; - virtual void rowActionClicked(gsl::not_null row) { + virtual void rowClicked(not_null row) = 0; + virtual void rowActionClicked(not_null row) { } virtual void loadMoreRows() { } - virtual void itemDeselectedHook(gsl::not_null peer) { + virtual void itemDeselectedHook(not_null peer) { } bool isSearchLoading() const { return _searchController ? _searchController->isLoading() : false; } - virtual std::unique_ptr createSearchRow(gsl::not_null peer) { + virtual std::unique_ptr createSearchRow(not_null peer) { return nullptr; } - bool isRowSelected(gsl::not_null peer) { + bool isRowSelected(not_null peer) { return delegate()->peerListIsRowSelected(peer); } @@ -291,13 +291,13 @@ public: bool hasComplexSearch() const; void search(const QString &query); - void peerListSearchAddRow(gsl::not_null peer) override; + void peerListSearchAddRow(not_null peer) override; void peerListSearchRefreshRows() override; virtual ~PeerListController() = default; protected: - gsl::not_null delegate() const { + not_null delegate() const { return _delegate; } PeerListSearchController *searchController() const { @@ -325,7 +325,7 @@ private: class PeerListBox : public BoxContent, public PeerListDelegate { public: - PeerListBox(QWidget*, std::unique_ptr controller, base::lambda)> init); + PeerListBox(QWidget*, std::unique_ptr controller, base::lambda)> init); void peerListSetTitle(base::lambda title) override { setTitle(std::move(title)); @@ -340,17 +340,17 @@ public: void peerListSetSearchMode(PeerListSearchMode mode) override; void peerListAppendRow(std::unique_ptr row) override; void peerListAppendSearchRow(std::unique_ptr row) override; - void peerListAppendFoundRow(gsl::not_null row) override; + void peerListAppendFoundRow(not_null row) override; void peerListPrependRow(std::unique_ptr row) override; - void peerListPrependRowFromSearchResult(gsl::not_null row) override; - void peerListUpdateRow(gsl::not_null row) override; - void peerListRemoveRow(gsl::not_null row) override; - void peerListConvertRowToSearchResult(gsl::not_null row) override; - void peerListSetRowChecked(gsl::not_null row, bool checked) override; - gsl::not_null peerListRowAt(int index) override; - bool peerListIsRowSelected(gsl::not_null peer) override; + void peerListPrependRowFromSearchResult(not_null row) override; + void peerListUpdateRow(not_null row) override; + void peerListRemoveRow(not_null row) override; + void peerListConvertRowToSearchResult(not_null row) override; + void peerListSetRowChecked(not_null row, bool checked) override; + not_null peerListRowAt(int index) override; + bool peerListIsRowSelected(not_null peer) override; int peerListSelectedRowsCount() override; - std::vector> peerListCollectSelectedRows() override; + std::vector> peerListCollectSelectedRows() override; void peerListRefreshRows() override; void peerListScrollToTop() override; int peerListFullRowsCount() override; @@ -367,12 +367,12 @@ protected: void paintEvent(QPaintEvent *e) override; private: - void peerListAddSelectedRowInBunch(gsl::not_null peer) override { + void peerListAddSelectedRowInBunch(not_null peer) override { addSelectItem(peer, PeerListRow::SetStyle::Fast); } void peerListFinishSelectedRowsBunch() override; - void addSelectItem(gsl::not_null peer, PeerListRow::SetStyle style); + void addSelectItem(not_null peer, PeerListRow::SetStyle style); void createMultiSelect(); int getTopScrollSkip() const; void updateScrollSkips(); @@ -394,7 +394,7 @@ class PeerListBox::Inner : public TWidget, private base::Subscriber { Q_OBJECT public: - Inner(QWidget *parent, gsl::not_null controller); + Inner(QWidget *parent, not_null controller); void selectSkip(int direction); void selectSkipPage(int height, int direction); @@ -409,17 +409,17 @@ public: // Interface for the controller. void appendRow(std::unique_ptr row); void appendSearchRow(std::unique_ptr row); - void appendFoundRow(gsl::not_null row); + void appendFoundRow(not_null row); void prependRow(std::unique_ptr row); - void prependRowFromSearchResult(gsl::not_null row); + void prependRowFromSearchResult(not_null row); PeerListRow *findRow(PeerListRowId id); - void updateRow(gsl::not_null row) { + void updateRow(not_null row) { updateRow(row, RowIndex()); } - void removeRow(gsl::not_null row); - void convertRowToSearchResult(gsl::not_null row); + void removeRow(not_null row); + void convertRowToSearchResult(not_null row); int fullRowsCount() const; - gsl::not_null rowAt(int index) const; + not_null rowAt(int index) const; void setDescription(object_ptr description); void setSearchLoading(object_ptr loading); void setSearchNoResults(object_ptr noResults); @@ -427,7 +427,7 @@ public: void refreshRows(); void setSearchMode(PeerListSearchMode mode); - void changeCheckState(gsl::not_null row, bool checked, PeerListRow::SetStyle style); + void changeCheckState(not_null row, bool checked, PeerListRow::SetStyle style); template void reorderRows(ReorderCallback &&callback) { @@ -499,19 +499,19 @@ private: void loadProfilePhotos(); void checkScrollForPreload(); - void updateRow(gsl::not_null row, RowIndex hint); + void updateRow(not_null row, RowIndex hint); void updateRow(RowIndex row); int getRowTop(RowIndex row) const; PeerListRow *getRow(RowIndex element); - RowIndex findRowIndex(gsl::not_null row, RowIndex hint = RowIndex()); - QRect getActionRect(gsl::not_null row, RowIndex index) const; + RowIndex findRowIndex(not_null row, RowIndex hint = RowIndex()); + QRect getActionRect(not_null row, RowIndex index) const; void paintRow(Painter &p, TimeMs ms, RowIndex index); - void addRowEntry(gsl::not_null row); - void addToSearchIndex(gsl::not_null row); + void addRowEntry(not_null row); + void addToSearchIndex(not_null row); bool addingToSearchIndex() const; - void removeFromSearchIndex(gsl::not_null row); + void removeFromSearchIndex(not_null row); void setSearchQuery(const QString &query, const QString &normalizedQuery); bool showingSearch() const { return !_searchQuery.isEmpty(); @@ -529,7 +529,7 @@ private: void clearSearchRows(); - gsl::not_null _controller; + not_null _controller; PeerListSearchMode _searchMode = PeerListSearchMode::Disabled; int _rowHeight = 0; @@ -541,14 +541,14 @@ private: bool _mouseSelection = false; std::vector> _rows; - std::map> _rowsById; - std::map>> _rowsByPeer; + std::map> _rowsById; + std::map>> _rowsByPeer; - std::map>> _searchIndex; + std::map>> _searchIndex; QString _searchQuery; QString _normalizedSearchQuery; QString _mentionHighlight; - std::vector> _filterResults; + std::vector> _filterResults; int _aboveHeight = 0; object_ptr _aboveWidget = { nullptr }; diff --git a/Telegram/SourceFiles/boxes/peer_list_controllers.cpp b/Telegram/SourceFiles/boxes/peer_list_controllers.cpp index 87afeaa5cf..dfc0115f27 100644 --- a/Telegram/SourceFiles/boxes/peer_list_controllers.cpp +++ b/Telegram/SourceFiles/boxes/peer_list_controllers.cpp @@ -33,7 +33,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org namespace { -base::flat_set> GetAlreadyInFromPeer(PeerData *peer) { +base::flat_set> GetAlreadyInFromPeer(PeerData *peer) { if (!peer) { return {}; } @@ -266,11 +266,11 @@ QString ChatsListBoxController::emptyBoxText() const { return lang(lng_contacts_not_found); } -std::unique_ptr ChatsListBoxController::createSearchRow(gsl::not_null peer) { +std::unique_ptr ChatsListBoxController::createSearchRow(not_null peer) { return createRow(App::history(peer)); } -bool ChatsListBoxController::appendRow(gsl::not_null history) { +bool ChatsListBoxController::appendRow(not_null history) { if (auto row = delegate()->peerListFindRow(history->peer->id)) { updateRowHook(static_cast(row)); return false; @@ -328,15 +328,15 @@ void ContactsBoxController::checkForEmptyRows() { } } -std::unique_ptr ContactsBoxController::createSearchRow(gsl::not_null peer) { +std::unique_ptr ContactsBoxController::createSearchRow(not_null peer) { return createRow(peer->asUser()); } -void ContactsBoxController::rowClicked(gsl::not_null row) { +void ContactsBoxController::rowClicked(not_null row) { Ui::showPeerHistory(row->peer(), ShowAtUnreadMsgId); } -bool ContactsBoxController::appendRow(gsl::not_null user) { +bool ContactsBoxController::appendRow(not_null user) { if (auto row = delegate()->peerListFindRow(user->id)) { updateRowHook(row); return false; @@ -348,7 +348,7 @@ bool ContactsBoxController::appendRow(gsl::not_null user) { return false; } -std::unique_ptr ContactsBoxController::createRow(gsl::not_null user) { +std::unique_ptr ContactsBoxController::createRow(not_null user) { return std::make_unique(user); } @@ -359,14 +359,14 @@ AddParticipantsBoxController::AddParticipantsBoxController(PeerData *peer) } AddParticipantsBoxController::AddParticipantsBoxController( - gsl::not_null channel, - base::flat_set> &&alreadyIn) + not_null channel, + base::flat_set> &&alreadyIn) : ContactsBoxController(std::make_unique()) , _peer(channel) , _alreadyIn(std::move(alreadyIn)) { } -void AddParticipantsBoxController::rowClicked(gsl::not_null row) { +void AddParticipantsBoxController::rowClicked(not_null row) { auto count = fullCount(); auto limit = (_peer && _peer->isMegagroup()) ? Global::MegagroupSizeMax() : Global::ChatSizeMax(); if (count < limit || row->checked()) { @@ -381,7 +381,7 @@ void AddParticipantsBoxController::rowClicked(gsl::not_null row) { } } -void AddParticipantsBoxController::itemDeselectedHook(gsl::not_null peer) { +void AddParticipantsBoxController::itemDeselectedHook(not_null peer) { updateTitle(); } @@ -401,7 +401,7 @@ int AddParticipantsBoxController::alreadyInCount() const { Unexpected("User in AddParticipantsBoxController::alreadyInCount"); } -bool AddParticipantsBoxController::isAlreadyIn(gsl::not_null user) const { +bool AddParticipantsBoxController::isAlreadyIn(not_null user) const { if (!_peer) { return false; } @@ -418,7 +418,7 @@ int AddParticipantsBoxController::fullCount() const { return alreadyInCount() + delegate()->peerListSelectedRowsCount(); } -std::unique_ptr AddParticipantsBoxController::createRow(gsl::not_null user) { +std::unique_ptr AddParticipantsBoxController::createRow(not_null user) { if (user->isSelf()) { return nullptr; } @@ -437,12 +437,12 @@ void AddParticipantsBoxController::updateTitle() { delegate()->peerListSetAdditionalTitle([additional] { return additional; }); } -void AddParticipantsBoxController::Start(gsl::not_null chat) { - auto initBox = [chat](gsl::not_null box) { +void AddParticipantsBoxController::Start(not_null chat) { + auto initBox = [chat](not_null box) { box->addButton(langFactory(lng_participant_invite), [box, chat] { auto rows = box->peerListCollectSelectedRows(); if (!rows.empty()) { - auto users = std::vector>(); + auto users = std::vector>(); for (auto peer : rows) { auto user = peer->asUser(); t_assert(user != nullptr); @@ -459,15 +459,15 @@ void AddParticipantsBoxController::Start(gsl::not_null chat) { } void AddParticipantsBoxController::Start( - gsl::not_null channel, - base::flat_set> &&alreadyIn, + not_null channel, + base::flat_set> &&alreadyIn, bool justCreated) { - auto initBox = [channel, justCreated](gsl::not_null box) { + auto initBox = [channel, justCreated](not_null box) { auto subscription = std::make_shared(); box->addButton(langFactory(lng_participant_invite), [box, channel, subscription] { auto rows = box->peerListCollectSelectedRows(); if (!rows.empty()) { - auto users = std::vector>(); + auto users = std::vector>(); for (auto peer : rows) { auto user = peer->asUser(); t_assert(user != nullptr); @@ -493,12 +493,12 @@ void AddParticipantsBoxController::Start( } void AddParticipantsBoxController::Start( - gsl::not_null channel, - base::flat_set> &&alreadyIn) { + not_null channel, + base::flat_set> &&alreadyIn) { Start(channel, std::move(alreadyIn), false); } -void AddParticipantsBoxController::Start(gsl::not_null channel) { +void AddParticipantsBoxController::Start(not_null channel) { Start(channel, {}, true); } @@ -548,7 +548,7 @@ void EditChatAdminsBoxController::LabeledCheckbox::paintEvent(QPaintEvent *e) { (checked() ? _labelChecked : _labelUnchecked).draw(p, st::contactsPadding.left(), st::contactsAboutTop, _labelWidth); } -EditChatAdminsBoxController::EditChatAdminsBoxController(gsl::not_null chat) +EditChatAdminsBoxController::EditChatAdminsBoxController(not_null chat) : PeerListController() , _chat(chat) { } @@ -609,7 +609,7 @@ void EditChatAdminsBoxController::rebuildRows() { auto allAdmins = allAreAdmins(); - auto admins = std::vector>(); + auto admins = std::vector>(); auto others = admins; admins.reserve(allAdmins ? _chat->participants.size() : _chat->admins.size()); others.reserve(_chat->participants.size()); @@ -636,7 +636,7 @@ void EditChatAdminsBoxController::rebuildRows() { std::sort(admins.begin(), admins.end(), sortByName); std::sort(others.begin(), others.end(), sortByName); - auto addOne = [this](gsl::not_null user) { + auto addOne = [this](not_null user) { if (auto row = createRow(user)) { delegate()->peerListAppendRow(std::move(row)); } @@ -652,7 +652,7 @@ void EditChatAdminsBoxController::rebuildRows() { delegate()->peerListRefreshRows(); } -std::unique_ptr EditChatAdminsBoxController::createRow(gsl::not_null user) { +std::unique_ptr EditChatAdminsBoxController::createRow(not_null user) { auto result = std::make_unique(user); if (allAreAdmins() || user->id == peerFromUser(_chat->creator)) { result->setDisabledState(PeerListRow::State::DisabledChecked); @@ -660,17 +660,17 @@ std::unique_ptr EditChatAdminsBoxController::createRow(gsl::not_nul return result; } -void EditChatAdminsBoxController::rowClicked(gsl::not_null row) { +void EditChatAdminsBoxController::rowClicked(not_null row) { delegate()->peerListSetRowChecked(row, !row->checked()); } -void EditChatAdminsBoxController::Start(gsl::not_null chat) { +void EditChatAdminsBoxController::Start(not_null chat) { auto controller = std::make_unique(chat); - auto initBox = [chat, controller = controller.get()](gsl::not_null box) { + auto initBox = [chat, controller = controller.get()](not_null box) { box->addButton(langFactory(lng_settings_save), [box, chat, controller] { auto rows = box->peerListCollectSelectedRows(); if (!rows.empty()) { - auto users = std::vector>(); + auto users = std::vector>(); for (auto peer : rows) { auto user = peer->asUser(); t_assert(user != nullptr); @@ -686,21 +686,21 @@ void EditChatAdminsBoxController::Start(gsl::not_null chat) { Ui::show(Box(std::move(controller), std::move(initBox))); } -void AddBotToGroupBoxController::Start(gsl::not_null bot) { - auto initBox = [bot](gsl::not_null box) { +void AddBotToGroupBoxController::Start(not_null bot) { + auto initBox = [bot](not_null box) { box->addButton(langFactory(lng_cancel), [box] { box->closeBox(); }); }; Ui::show(Box(std::make_unique(bot), std::move(initBox))); } -AddBotToGroupBoxController::AddBotToGroupBoxController(gsl::not_null bot) +AddBotToGroupBoxController::AddBotToGroupBoxController(not_null bot) : ChatsListBoxController(SharingBotGame(bot) ? std::make_unique() : nullptr) , _bot(bot) { } -void AddBotToGroupBoxController::rowClicked(gsl::not_null row) { +void AddBotToGroupBoxController::rowClicked(not_null row) { if (sharingBotGame()) { shareBotGame(row->peer()); } else { @@ -708,7 +708,7 @@ void AddBotToGroupBoxController::rowClicked(gsl::not_null row) { } } -void AddBotToGroupBoxController::shareBotGame(gsl::not_null chat) { +void AddBotToGroupBoxController::shareBotGame(not_null chat) { auto weak = base::make_weak_unique(this); auto send = [weak, bot = _bot, chat] { if (!weak) { @@ -746,7 +746,7 @@ void AddBotToGroupBoxController::shareBotGame(gsl::not_null chat) { Ui::show(Box(confirmText(), send), KeepOtherLayers); } -void AddBotToGroupBoxController::addBotToGroup(gsl::not_null chat) { +void AddBotToGroupBoxController::addBotToGroup(not_null chat) { if (auto megagroup = chat->asMegagroup()) { if (!megagroup->canAddMembers()) { Ui::show(Box(lang(lng_error_cant_add_member)), KeepOtherLayers); @@ -788,14 +788,14 @@ void AddBotToGroupBoxController::addBotToGroup(gsl::not_null chat) { Ui::show(Box(confirmText, send), KeepOtherLayers); } -std::unique_ptr AddBotToGroupBoxController::createRow(gsl::not_null history) { +std::unique_ptr AddBotToGroupBoxController::createRow(not_null history) { if (!needToCreateRow(history->peer)) { return nullptr; } return std::make_unique(history); } -bool AddBotToGroupBoxController::needToCreateRow(gsl::not_null peer) const { +bool AddBotToGroupBoxController::needToCreateRow(not_null peer) const { if (sharingBotGame()) { if (!peer->canWrite()) { return false; @@ -817,7 +817,7 @@ bool AddBotToGroupBoxController::needToCreateRow(gsl::not_null peer) return false; } -bool AddBotToGroupBoxController::SharingBotGame(gsl::not_null bot) { +bool AddBotToGroupBoxController::SharingBotGame(not_null bot) { auto &info = bot->botInfo; return (info && !info->shareGameShortName.isEmpty()); } diff --git a/Telegram/SourceFiles/boxes/peer_list_controllers.h b/Telegram/SourceFiles/boxes/peer_list_controllers.h index 17ce6e6d55..de09525809 100644 --- a/Telegram/SourceFiles/boxes/peer_list_controllers.h +++ b/Telegram/SourceFiles/boxes/peer_list_controllers.h @@ -88,31 +88,31 @@ public: ChatsListBoxController(std::unique_ptr searchController = std::make_unique()); void prepare() override final; - std::unique_ptr createSearchRow(gsl::not_null peer) override final; + std::unique_ptr createSearchRow(not_null peer) override final; protected: class Row : public PeerListRow { public: - Row(gsl::not_null history) : PeerListRow(history->peer), _history(history) { + Row(not_null history) : PeerListRow(history->peer), _history(history) { } - gsl::not_null history() const { + not_null history() const { return _history; } private: - gsl::not_null _history; + not_null _history; }; - virtual std::unique_ptr createRow(gsl::not_null history) = 0; + virtual std::unique_ptr createRow(not_null history) = 0; virtual void prepareViewHook() = 0; - virtual void updateRowHook(gsl::not_null row) { + virtual void updateRowHook(not_null row) { } virtual QString emptyBoxText() const; private: void rebuildRows(); void checkForEmptyRows(); - bool appendRow(gsl::not_null history); + bool appendRow(not_null history); }; @@ -121,40 +121,40 @@ public: ContactsBoxController(std::unique_ptr searchController = std::make_unique()); void prepare() override final; - std::unique_ptr createSearchRow(gsl::not_null peer) override final; - void rowClicked(gsl::not_null row) override; + std::unique_ptr createSearchRow(not_null peer) override final; + void rowClicked(not_null row) override; protected: - virtual std::unique_ptr createRow(gsl::not_null user); + virtual std::unique_ptr createRow(not_null user); virtual void prepareViewHook() { } - virtual void updateRowHook(gsl::not_null row) { + virtual void updateRowHook(not_null row) { } private: void rebuildRows(); void checkForEmptyRows(); - bool appendRow(gsl::not_null user); + bool appendRow(not_null user); }; class EditChatAdminsBoxController : public PeerListController, private base::Subscriber { public: - static void Start(gsl::not_null chat); + static void Start(not_null chat); - EditChatAdminsBoxController(gsl::not_null chat); + EditChatAdminsBoxController(not_null chat); bool allAreAdmins() const; void prepare() override; - void rowClicked(gsl::not_null row) override; + void rowClicked(not_null row) override; private: void createAllAdminsCheckbox(); void rebuildRows(); - std::unique_ptr createRow(gsl::not_null user); + std::unique_ptr createRow(not_null user); - gsl::not_null _chat; + not_null _chat; int _adminsUpdatedSubscription = 0; class LabeledCheckbox; @@ -164,67 +164,67 @@ private: class AddParticipantsBoxController : public ContactsBoxController { public: - static void Start(gsl::not_null chat); - static void Start(gsl::not_null channel); + static void Start(not_null chat); + static void Start(not_null channel); static void Start( - gsl::not_null channel, - base::flat_set> &&alreadyIn); + not_null channel, + base::flat_set> &&alreadyIn); AddParticipantsBoxController(PeerData *peer); AddParticipantsBoxController( - gsl::not_null channel, - base::flat_set> &&alreadyIn); + not_null channel, + base::flat_set> &&alreadyIn); using ContactsBoxController::ContactsBoxController; - void rowClicked(gsl::not_null row) override; - void itemDeselectedHook(gsl::not_null peer) override; + void rowClicked(not_null row) override; + void itemDeselectedHook(not_null peer) override; protected: void prepareViewHook() override; - std::unique_ptr createRow(gsl::not_null user) override; + std::unique_ptr createRow(not_null user) override; private: static void Start( - gsl::not_null channel, - base::flat_set> &&alreadyIn, + not_null channel, + base::flat_set> &&alreadyIn, bool justCreated); int alreadyInCount() const; - bool isAlreadyIn(gsl::not_null user) const; + bool isAlreadyIn(not_null user) const; int fullCount() const; void updateTitle(); PeerData *_peer = nullptr; - base::flat_set> _alreadyIn; + base::flat_set> _alreadyIn; }; class AddBotToGroupBoxController : public ChatsListBoxController, public base::enable_weak_from_this { public: - static void Start(gsl::not_null bot); + static void Start(not_null bot); - AddBotToGroupBoxController(gsl::not_null bot); + AddBotToGroupBoxController(not_null bot); - void rowClicked(gsl::not_null row) override; + void rowClicked(not_null row) override; protected: - std::unique_ptr createRow(gsl::not_null history) override; + std::unique_ptr createRow(not_null history) override; void prepareViewHook() override; QString emptyBoxText() const override; private: - static bool SharingBotGame(gsl::not_null bot); + static bool SharingBotGame(not_null bot); - bool needToCreateRow(gsl::not_null peer) const; + bool needToCreateRow(not_null peer) const; bool sharingBotGame() const; QString noResultsText() const; QString descriptionText() const; void updateLabels(); - void shareBotGame(gsl::not_null chat); - void addBotToGroup(gsl::not_null chat); + void shareBotGame(not_null chat); + void addBotToGroup(not_null chat); - gsl::not_null _bot; + not_null _bot; }; diff --git a/Telegram/SourceFiles/boxes/stickers_box.cpp b/Telegram/SourceFiles/boxes/stickers_box.cpp index ca408668d4..90c8dfd911 100644 --- a/Telegram/SourceFiles/boxes/stickers_box.cpp +++ b/Telegram/SourceFiles/boxes/stickers_box.cpp @@ -156,7 +156,7 @@ StickersBox::StickersBox(QWidget*, const Stickers::Order &archivedIds) , _about(st::boxLabelStyle, lang(lng_stickers_packs_archived), _defaultOptions, _aboutWidth) { } -StickersBox::StickersBox(QWidget*, gsl::not_null megagroup) +StickersBox::StickersBox(QWidget*, not_null megagroup) : _section(Section::Installed) , _installed(0, this, megagroup) , _megagroupSet(megagroup) { @@ -625,7 +625,7 @@ StickersBox::Inner::Inner(QWidget *parent, const Stickers::Order &archivedIds) : setup(); } -StickersBox::Inner::Inner(QWidget *parent, gsl::not_null megagroup) : TWidget(parent) +StickersBox::Inner::Inner(QWidget *parent, not_null megagroup) : TWidget(parent) , _section(StickersBox::Section::Installed) , _rowHeight(st::contactsPadding.top() + st::contactsPhotoSize + st::contactsPadding.bottom()) , _a_shifting(animation(this, &Inner::step_shifting)) diff --git a/Telegram/SourceFiles/boxes/stickers_box.h b/Telegram/SourceFiles/boxes/stickers_box.h index d2bc48ecdf..ba63e3f358 100644 --- a/Telegram/SourceFiles/boxes/stickers_box.h +++ b/Telegram/SourceFiles/boxes/stickers_box.h @@ -49,7 +49,7 @@ public: }; StickersBox(QWidget*, Section section); StickersBox(QWidget*, const Stickers::Order &archivedIds); - StickersBox(QWidget*, gsl::not_null megagroup); + StickersBox(QWidget*, not_null megagroup); void setInnerFocus() override; @@ -154,7 +154,7 @@ public: using Section = StickersBox::Section; Inner(QWidget *parent, Section section); Inner(QWidget *parent, const Stickers::Order &archivedIds); - Inner(QWidget *parent, gsl::not_null megagroup); + Inner(QWidget *parent, not_null megagroup); base::Observable scrollToY; void setInnerFocus(); diff --git a/Telegram/SourceFiles/calls/calls_box_controller.cpp b/Telegram/SourceFiles/calls/calls_box_controller.cpp index 8af9d02c31..dca17afd8b 100644 --- a/Telegram/SourceFiles/calls/calls_box_controller.cpp +++ b/Telegram/SourceFiles/calls/calls_box_controller.cpp @@ -243,13 +243,13 @@ void BoxController::refreshAbout() { setDescriptionText(delegate()->peerListFullRowsCount() ? QString() : lang(lng_call_box_about)); } -void BoxController::rowClicked(gsl::not_null row) { +void BoxController::rowClicked(not_null row) { auto itemsRow = static_cast(row.get()); auto itemId = itemsRow->maxItemId(); Ui::showPeerHistoryAsync(row->peer()->id, itemId); } -void BoxController::rowActionClicked(gsl::not_null row) { +void BoxController::rowActionClicked(not_null row) { auto user = row->peer()->asUser(); t_assert(user != nullptr); diff --git a/Telegram/SourceFiles/calls/calls_box_controller.h b/Telegram/SourceFiles/calls/calls_box_controller.h index e32c998913..cbaf79d9d7 100644 --- a/Telegram/SourceFiles/calls/calls_box_controller.h +++ b/Telegram/SourceFiles/calls/calls_box_controller.h @@ -27,8 +27,8 @@ namespace Calls { class BoxController : public PeerListController, private base::Subscriber, private MTP::Sender { public: void prepare() override; - void rowClicked(gsl::not_null row) override; - void rowActionClicked(gsl::not_null row) override; + void rowClicked(not_null row) override; + void rowActionClicked(not_null row) override; void loadMoreRows() override; private: diff --git a/Telegram/SourceFiles/calls/calls_call.cpp b/Telegram/SourceFiles/calls/calls_call.cpp index e2a72052a3..84c6642000 100644 --- a/Telegram/SourceFiles/calls/calls_call.cpp +++ b/Telegram/SourceFiles/calls/calls_call.cpp @@ -77,7 +77,7 @@ uint64 ComputeFingerprint(const std::array &aut } // namespace -Call::Call(gsl::not_null delegate, gsl::not_null user, Type type) +Call::Call(not_null delegate, not_null user, Type type) : _delegate(delegate) , _user(user) , _type(type) { diff --git a/Telegram/SourceFiles/calls/calls_call.h b/Telegram/SourceFiles/calls/calls_call.h index e5b8bc30e3..447463b37c 100644 --- a/Telegram/SourceFiles/calls/calls_call.h +++ b/Telegram/SourceFiles/calls/calls_call.h @@ -48,9 +48,9 @@ public: class Delegate { public: virtual DhConfig getDhConfig() const = 0; - virtual void callFinished(gsl::not_null call) = 0; - virtual void callFailed(gsl::not_null call) = 0; - virtual void callRedial(gsl::not_null call) = 0; + virtual void callFinished(not_null call) = 0; + virtual void callFailed(not_null call) = 0; + virtual void callRedial(not_null call) = 0; enum class Sound { Connecting, @@ -69,12 +69,12 @@ public: Incoming, Outgoing, }; - Call(gsl::not_null delegate, gsl::not_null user, Type type); + Call(not_null delegate, not_null user, Type type); Type type() const { return _type; } - gsl::not_null user() const { + not_null user() const { return _user; } bool isIncomingWaiting() const; @@ -157,8 +157,8 @@ private: void setFailedQueued(int error); void destroyController(); - gsl::not_null _delegate; - gsl::not_null _user; + not_null _delegate; + not_null _user; Type _type = Type::Outgoing; State _state = State::Starting; FinishType _finishAfterRequestingCall = FinishType::None; diff --git a/Telegram/SourceFiles/calls/calls_emoji_fingerprint.cpp b/Telegram/SourceFiles/calls/calls_emoji_fingerprint.cpp index ecaab45aec..0c0b0d929e 100644 --- a/Telegram/SourceFiles/calls/calls_emoji_fingerprint.cpp +++ b/Telegram/SourceFiles/calls/calls_emoji_fingerprint.cpp @@ -126,7 +126,7 @@ uint64 ComputeEmojiIndex(base::const_byte_span bytes) { } // namespace -std::vector ComputeEmojiFingerprint(gsl::not_null call) { +std::vector ComputeEmojiFingerprint(not_null call) { auto result = std::vector(); constexpr auto EmojiCount = (base::array_size(Offsets) - 1); for (auto index = 0; index != EmojiCount; ++index) { diff --git a/Telegram/SourceFiles/calls/calls_emoji_fingerprint.h b/Telegram/SourceFiles/calls/calls_emoji_fingerprint.h index cb432a911d..9fe4c7279d 100644 --- a/Telegram/SourceFiles/calls/calls_emoji_fingerprint.h +++ b/Telegram/SourceFiles/calls/calls_emoji_fingerprint.h @@ -24,6 +24,6 @@ namespace Calls { class Call; -std::vector ComputeEmojiFingerprint(gsl::not_null call); +std::vector ComputeEmojiFingerprint(not_null call); } // namespace Calls diff --git a/Telegram/SourceFiles/calls/calls_instance.cpp b/Telegram/SourceFiles/calls/calls_instance.cpp index 7275897f7f..9bb9447f8f 100644 --- a/Telegram/SourceFiles/calls/calls_instance.cpp +++ b/Telegram/SourceFiles/calls/calls_instance.cpp @@ -40,7 +40,7 @@ constexpr auto kServerConfigUpdateTimeoutMs = 24 * 3600 * TimeMs(1000); Instance::Instance() = default; -void Instance::startOutgoingCall(gsl::not_null user) { +void Instance::startOutgoingCall(not_null user) { if (alreadyInCall()) { // Already in a call. _currentCallPanel->showAndActivate(); return; @@ -54,15 +54,15 @@ void Instance::startOutgoingCall(gsl::not_null user) { createCall(user, Call::Type::Outgoing); } -void Instance::callFinished(gsl::not_null call) { +void Instance::callFinished(not_null call) { destroyCall(call); } -void Instance::callFailed(gsl::not_null call) { +void Instance::callFailed(not_null call) { destroyCall(call); } -void Instance::callRedial(gsl::not_null call) { +void Instance::callRedial(not_null call) { if (_currentCall.get() == call) { refreshDhConfig(); } @@ -96,7 +96,7 @@ void Instance::playSound(Sound sound) { } } -void Instance::destroyCall(gsl::not_null call) { +void Instance::destroyCall(not_null call) { if (_currentCall.get() == call) { destroyCurrentPanel(); _currentCall.reset(); @@ -117,7 +117,7 @@ void Instance::destroyCurrentPanel() { _pendingPanels.back()->hideAndDestroy(); // Always queues the destruction. } -void Instance::createCall(gsl::not_null user, Call::Type type) { +void Instance::createCall(not_null user, Call::Type type) { auto call = std::make_unique(getCallDelegate(), user, type);; if (_currentCall) { _currentCallPanel->replaceCall(call.get()); @@ -246,7 +246,7 @@ void Instance::handleUpdate(const MTPDupdatePhoneCall& update) { handleCallUpdate(update.vphone_call); } -void Instance::showInfoPanel(gsl::not_null call) { +void Instance::showInfoPanel(not_null call) { if (_currentCall.get() == call) { _currentCallPanel->showAndActivate(); } diff --git a/Telegram/SourceFiles/calls/calls_instance.h b/Telegram/SourceFiles/calls/calls_instance.h index 914dbdb4cd..89c8c71630 100644 --- a/Telegram/SourceFiles/calls/calls_instance.h +++ b/Telegram/SourceFiles/calls/calls_instance.h @@ -37,9 +37,9 @@ class Instance : private MTP::Sender, private Call::Delegate, private base::Subs public: Instance(); - void startOutgoingCall(gsl::not_null user); + void startOutgoingCall(not_null user); void handleUpdate(const MTPDupdatePhoneCall &update); - void showInfoPanel(gsl::not_null call); + void showInfoPanel(not_null call); base::Observable ¤tCallChanged() { return _currentCallChanged; @@ -54,19 +54,19 @@ public: ~Instance(); private: - gsl::not_null getCallDelegate() { + not_null getCallDelegate() { return static_cast(this); } DhConfig getDhConfig() const override { return _dhConfig; } - void callFinished(gsl::not_null call) override; - void callFailed(gsl::not_null call) override; - void callRedial(gsl::not_null call) override; + void callFinished(not_null call) override; + void callFailed(not_null call) override; + void callRedial(not_null call) override; using Sound = Call::Delegate::Sound; void playSound(Sound sound) override; - void createCall(gsl::not_null user, Call::Type type); - void destroyCall(gsl::not_null call); + void createCall(not_null user, Call::Type type); + void destroyCall(not_null call); void destroyCurrentPanel(); void refreshDhConfig(); diff --git a/Telegram/SourceFiles/calls/calls_panel.cpp b/Telegram/SourceFiles/calls/calls_panel.cpp index ea0f85f5d4..c13facca06 100644 --- a/Telegram/SourceFiles/calls/calls_panel.cpp +++ b/Telegram/SourceFiles/calls/calls_panel.cpp @@ -61,10 +61,10 @@ protected: QPoint prepareRippleStartPosition() const override; private: - QPoint iconPosition(gsl::not_null st) const; + QPoint iconPosition(not_null st) const; void mixIconMasks(); - gsl::not_null _stFrom; + not_null _stFrom; const style::CallButton *_stTo = nullptr; float64 _progress = 0.; @@ -192,7 +192,7 @@ void Panel::Button::paintEvent(QPaintEvent *e) { } } -QPoint Panel::Button::iconPosition(gsl::not_null st) const { +QPoint Panel::Button::iconPosition(not_null st) const { auto result = st->button.iconPosition; if (result.x() < 0) { 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)); } -Panel::Panel(gsl::not_null call) +Panel::Panel(not_null call) : _call(call) , _user(call->user()) , _answerHangupRedial(this, st::callAnswer, &st::callHangup) @@ -264,7 +264,7 @@ void Panel::showAndActivate() { setFocus(); } -void Panel::replaceCall(gsl::not_null call) { +void Panel::replaceCall(not_null call) { _call = call; _user = call->user(); reinitControls(); diff --git a/Telegram/SourceFiles/calls/calls_panel.h b/Telegram/SourceFiles/calls/calls_panel.h index 5b7a525412..c101ee38b7 100644 --- a/Telegram/SourceFiles/calls/calls_panel.h +++ b/Telegram/SourceFiles/calls/calls_panel.h @@ -36,10 +36,10 @@ namespace Calls { class Panel : public TWidget, private base::Subscriber, private Ui::AbstractTooltipShower { public: - Panel(gsl::not_null call); + Panel(not_null call); void showAndActivate(); - void replaceCall(gsl::not_null call); + void replaceCall(not_null call); void hideAndDestroy(); protected: @@ -89,7 +89,7 @@ private: void destroyDelayed(); Call *_call = nullptr; - gsl::not_null _user; + not_null _user; bool _useTransparency = true; style::margins _padding; diff --git a/Telegram/SourceFiles/chat_helpers/bot_keyboard.cpp b/Telegram/SourceFiles/chat_helpers/bot_keyboard.cpp index a64c200427..e933ba2b33 100644 --- a/Telegram/SourceFiles/chat_helpers/bot_keyboard.cpp +++ b/Telegram/SourceFiles/chat_helpers/bot_keyboard.cpp @@ -52,7 +52,7 @@ const style::TextStyle &BotKeyboard::Style::textStyle() const { return st::botKbStyle; } -void BotKeyboard::Style::repaint(gsl::not_null item) const { +void BotKeyboard::Style::repaint(not_null item) const { _parent->update(); } diff --git a/Telegram/SourceFiles/chat_helpers/bot_keyboard.h b/Telegram/SourceFiles/chat_helpers/bot_keyboard.h index 519dd2323d..a307318251 100644 --- a/Telegram/SourceFiles/chat_helpers/bot_keyboard.h +++ b/Telegram/SourceFiles/chat_helpers/bot_keyboard.h @@ -92,7 +92,7 @@ private: void startPaint(Painter &p) const override; const style::TextStyle &textStyle() const override; - void repaint(gsl::not_null item) const override; + void repaint(not_null item) const override; protected: void paintButtonBg(Painter &p, const QRect &rect, float64 howMuchOver) const override; diff --git a/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp index 7daefb071d..1c41a9cb3d 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/emoji_list_widget.cpp @@ -35,7 +35,7 @@ constexpr auto kEmojiPanelRowsPerPage = Ui::Emoji::kPanelRowsPerPage; class EmojiListWidget::Footer : public TabbedSelector::InnerFooter { public: - Footer(gsl::not_null parent); + Footer(not_null parent); void setCurrentSectionIcon(Section section); @@ -46,12 +46,12 @@ private: void prepareSection(int &left, int top, int _width, Ui::IconButton *sectionIcon, Section section); void setActiveSection(Section section); - gsl::not_null _pan; + not_null _pan; std::array, kEmojiSectionCount> _sections; }; -EmojiListWidget::Footer::Footer(gsl::not_null parent) : InnerFooter(parent) +EmojiListWidget::Footer::Footer(not_null parent) : InnerFooter(parent) , _pan(parent) , _sections { { object_ptr(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)); } -EmojiListWidget::EmojiListWidget(QWidget *parent, gsl::not_null controller) : Inner(parent, controller) +EmojiListWidget::EmojiListWidget(QWidget *parent, not_null controller) : Inner(parent, controller) , _picker(this) { resize(st::emojiPanWidth - st::emojiScroll.width - st::buttonRadius, countHeight()); diff --git a/Telegram/SourceFiles/chat_helpers/emoji_list_widget.h b/Telegram/SourceFiles/chat_helpers/emoji_list_widget.h index 2e6f67df6e..42dcd7843e 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_list_widget.h +++ b/Telegram/SourceFiles/chat_helpers/emoji_list_widget.h @@ -88,7 +88,7 @@ class EmojiListWidget : public TabbedSelector::Inner { Q_OBJECT public: - EmojiListWidget(QWidget *parent, gsl::not_null controller); + EmojiListWidget(QWidget *parent, not_null controller); using Section = Ui::Emoji::Section; diff --git a/Telegram/SourceFiles/chat_helpers/emoji_suggestions_widget.cpp b/Telegram/SourceFiles/chat_helpers/emoji_suggestions_widget.cpp index d6ea9012a4..38c99436aa 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_suggestions_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/emoji_suggestions_widget.cpp @@ -37,14 +37,14 @@ constexpr auto kRowLimit = 5; class SuggestionsWidget::Row { public: - Row(gsl::not_null emoji, const QString &label, const QString &replacement); + Row(not_null emoji, const QString &label, const QString &replacement); Row(const Row &other) = delete; Row &operator=(const Row &other) = delete; Row(Row &&other) = default; Row &operator=(Row &&other) = default; ~Row(); - gsl::not_null emoji() const { + not_null emoji() const { return _emoji; } const QString &label() const { @@ -64,14 +64,14 @@ public: } private: - gsl::not_null _emoji; + not_null _emoji; QString _label; QString _replacement; std::unique_ptr _ripple; }; -SuggestionsWidget::Row::Row(gsl::not_null emoji, const QString &label, const QString &replacement) +SuggestionsWidget::Row::Row(not_null emoji, const QString &label, const QString &replacement) : _emoji(emoji) , _label(label) , _replacement(replacement) { @@ -359,7 +359,7 @@ void SuggestionsWidget::leaveEventHook(QEvent *e) { return TWidget::leaveEventHook(e); } -SuggestionsController::SuggestionsController(QWidget *parent, gsl::not_null field) : QObject(nullptr) +SuggestionsController::SuggestionsController(QWidget *parent, not_null field) : QObject(nullptr) , _field(field) , _container(parent, st::emojiSuggestionsDropdown) , _suggestions(_container->setOwnedWidget(object_ptr(parent, st::emojiSuggestionsMenu))) { diff --git a/Telegram/SourceFiles/chat_helpers/emoji_suggestions_widget.h b/Telegram/SourceFiles/chat_helpers/emoji_suggestions_widget.h index 0dd53f6710..5fce90a306 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_suggestions_widget.h +++ b/Telegram/SourceFiles/chat_helpers/emoji_suggestions_widget.h @@ -65,7 +65,7 @@ private: void triggerSelectedRow(); void triggerRow(const Row &row); - gsl::not_null _st; + not_null _st; QString _query; std::vector _rows; @@ -79,7 +79,7 @@ private: class SuggestionsController : public QObject, private base::Subscriber { public: - SuggestionsController(QWidget *parent, gsl::not_null field); + SuggestionsController(QWidget *parent, not_null field); void raise(); diff --git a/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp index 113cb6984f..5e91e0bb19 100644 --- a/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp @@ -45,7 +45,7 @@ constexpr auto kSearchBotUsername = str_const("gif"); class GifsListWidget::Footer : public TabbedSelector::InnerFooter { public: - Footer(gsl::not_null parent); + Footer(not_null parent); void stealFocus(); void returnFocus(); @@ -59,7 +59,7 @@ protected: void processPanelHideFinished() override; private: - gsl::not_null _pan; + not_null _pan; object_ptr _field; object_ptr _cancel; @@ -68,7 +68,7 @@ private: }; -GifsListWidget::Footer::Footer(gsl::not_null parent) : InnerFooter(parent) +GifsListWidget::Footer::Footer(not_null parent) : InnerFooter(parent) , _pan(parent) , _field(this, st::gifsSearchField, langFactory(lng_gifs_search)) , _cancel(this, st::gifsSearchCancel) { @@ -120,7 +120,7 @@ void GifsListWidget::Footer::processPanelHideFinished() { //_field->setText(QString()); } -GifsListWidget::GifsListWidget(QWidget *parent, gsl::not_null controller) : Inner(parent, controller) +GifsListWidget::GifsListWidget(QWidget *parent, not_null controller) : Inner(parent, controller) , _section(Section::Gifs) { resize(st::emojiPanWidth - st::emojiScroll.width - st::buttonRadius, countHeight()); diff --git a/Telegram/SourceFiles/chat_helpers/gifs_list_widget.h b/Telegram/SourceFiles/chat_helpers/gifs_list_widget.h index e1d6e1c7aa..6dfa4b3d85 100644 --- a/Telegram/SourceFiles/chat_helpers/gifs_list_widget.h +++ b/Telegram/SourceFiles/chat_helpers/gifs_list_widget.h @@ -44,7 +44,7 @@ class GifsListWidget : public TabbedSelector::Inner, public InlineBots::Layout:: Q_OBJECT public: - GifsListWidget(QWidget *parent, gsl::not_null controller); + GifsListWidget(QWidget *parent, not_null controller); void refreshRecent() override; void preloadImages() override; diff --git a/Telegram/SourceFiles/chat_helpers/message_field.cpp b/Telegram/SourceFiles/chat_helpers/message_field.cpp index f5e05f1e03..5a03876d67 100644 --- a/Telegram/SourceFiles/chat_helpers/message_field.cpp +++ b/Telegram/SourceFiles/chat_helpers/message_field.cpp @@ -111,7 +111,7 @@ std::unique_ptr MimeDataFromTextWithEntities(const TextWithEntities & return result; } -MessageField::MessageField(QWidget *parent, gsl::not_null controller, const style::FlatTextarea &st, base::lambda placeholderFactory, const QString &val) : Ui::FlatTextarea(parent, st, std::move(placeholderFactory), val) +MessageField::MessageField(QWidget *parent, not_null controller, const style::FlatTextarea &st, base::lambda placeholderFactory, const QString &val) : Ui::FlatTextarea(parent, st, std::move(placeholderFactory), val) , _controller(controller) { setMinHeight(st::historySendSize.height() - 2 * st::historySendPadding); setMaxHeight(st::historyComposeFieldMaxHeight); diff --git a/Telegram/SourceFiles/chat_helpers/message_field.h b/Telegram/SourceFiles/chat_helpers/message_field.h index 88cee7f9d5..3b983a91c3 100644 --- a/Telegram/SourceFiles/chat_helpers/message_field.h +++ b/Telegram/SourceFiles/chat_helpers/message_field.h @@ -37,7 +37,7 @@ class MessageField final : public Ui::FlatTextarea { Q_OBJECT public: - MessageField(QWidget *parent, gsl::not_null controller, const style::FlatTextarea &st, base::lambda placeholderFactory = base::lambda(), const QString &val = QString()); + MessageField(QWidget *parent, not_null controller, const style::FlatTextarea &st, base::lambda placeholderFactory = base::lambda(), const QString &val = QString()); bool hasSendText() const; @@ -58,7 +58,7 @@ protected: void insertFromMimeData(const QMimeData *source) override; private: - gsl::not_null _controller; + not_null _controller; base::lambda _insertFromMimeDataHook; }; diff --git a/Telegram/SourceFiles/chat_helpers/stickers.cpp b/Telegram/SourceFiles/chat_helpers/stickers.cpp index ef796ed3c7..d3043ff854 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers.cpp @@ -183,7 +183,7 @@ void MarkFeaturedAsRead(uint64 setId) { FeaturedReaderInstance->scheduleRead(setId); } -bool IsFaved(gsl::not_null document) { +bool IsFaved(not_null document) { auto it = Global::StickerSets().constFind(FavedSetId); return (it != Global::StickerSets().cend()) && it->stickers.contains(document); } @@ -209,8 +209,8 @@ void CheckFavedLimit(Set &set) { void PushFavedToFront( Set &set, - gsl::not_null document, - const std::vector> &emojiList) { + not_null document, + const std::vector> &emojiList) { set.stickers.push_front(document); for (auto emoji : emojiList) { set.emoji[emoji].push_front(document); @@ -236,9 +236,9 @@ void MoveFavedToFront(Set &set, int index) { } } -void RequestSetToPushFaved(gsl::not_null document); +void RequestSetToPushFaved(not_null document); -void SetIsFaved(gsl::not_null document, base::optional>> emojiList = base::none) { +void SetIsFaved(not_null document, base::optional>> emojiList = base::none) { auto &sets = Global::RefStickerSets(); auto it = sets.find(FavedSetId); if (it == sets.end()) { @@ -263,8 +263,8 @@ void SetIsFaved(gsl::not_null document, base::optionalonStickersInstalled(FavedSetId); } -void RequestSetToPushFaved(gsl::not_null document) { - auto addAnyway = [document](std::vector> list) { +void RequestSetToPushFaved(not_null document) { + auto addAnyway = [document](std::vector> list) { if (list.empty()) { if (auto sticker = document->sticker()) { if (auto emoji = Ui::Emoji::Find(sticker->alt)) { @@ -276,7 +276,7 @@ void RequestSetToPushFaved(gsl::not_null document) { }; MTP::send(MTPmessages_GetStickerSet(document->sticker()->set), rpcDone([document, addAnyway](const MTPmessages_StickerSet &result) { Expects(result.type() == mtpc_messages_stickerSet); - auto list = std::vector>(); + auto list = std::vector>(); auto &d = result.c_messages_stickerSet(); list.reserve(d.vpacks.v.size()); for_const (auto &mtpPack, d.vpacks.v) { @@ -301,7 +301,7 @@ void RequestSetToPushFaved(gsl::not_null document) { })); } -void SetIsNotFaved(gsl::not_null document) { +void SetIsNotFaved(not_null document) { auto &sets = Global::RefStickerSets(); auto it = sets.find(FavedSetId); if (it == sets.end()) { @@ -330,7 +330,7 @@ void SetIsNotFaved(gsl::not_null document) { Auth().data().stickersUpdated().notify(true); } -void SetFaved(gsl::not_null document, bool faved) { +void SetFaved(not_null document, bool faved) { if (faved) { SetIsFaved(document); } else { @@ -629,7 +629,7 @@ void GifsReceived(const QVector &items, int32 hash) { Auth().data().savedGifsUpdated().notify(); } -StickerPack GetListByEmoji(gsl::not_null emoji) { +StickerPack GetListByEmoji(not_null emoji) { auto original = emoji->original(); auto result = StickerPack(); auto setsToRequest = QMap(); @@ -673,8 +673,8 @@ StickerPack GetListByEmoji(gsl::not_null emoji) { return result; } -base::optional>> GetEmojiListFromSet( - gsl::not_null document) { +base::optional>> GetEmojiListFromSet( + not_null document) { if (auto sticker = document->sticker()) { auto &inputSet = sticker->set; if (inputSet.type() != mtpc_inputStickerSetID) { @@ -685,7 +685,7 @@ base::optional>> GetEmojiListFromSet( if (it == sets.cend()) { return base::none; } - auto result = std::vector>(); + auto result = std::vector>(); for (auto i = it->emoji.cbegin(), e = it->emoji.cend(); i != e; ++i) { if (i->contains(document)) { result.push_back(i.key()); diff --git a/Telegram/SourceFiles/chat_helpers/stickers.h b/Telegram/SourceFiles/chat_helpers/stickers.h index 22d5bf357a..4d9b737c0b 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers.h +++ b/Telegram/SourceFiles/chat_helpers/stickers.h @@ -31,17 +31,17 @@ bool ApplyArchivedResultFake(); // For testing. void InstallLocally(uint64 setId); void UndoInstallLocally(uint64 setId); void MarkFeaturedAsRead(uint64 setId); -bool IsFaved(gsl::not_null document); -void SetFaved(gsl::not_null document, bool faved); +bool IsFaved(not_null document); +void SetFaved(not_null document, bool faved); void SetsReceived(const QVector &data, int32 hash); void SpecialSetReceived(uint64 setId, const QString &setTitle, const QVector &items, int32 hash, const QVector &packs = QVector()); void FeaturedSetsReceived(const QVector &data, const QVector &unread, int32 hash); void GifsReceived(const QVector &items, int32 hash); -StickerPack GetListByEmoji(gsl::not_null emoji); -base::optional>> GetEmojiListFromSet( - gsl::not_null document); +StickerPack GetListByEmoji(not_null emoji); +base::optional>> GetEmojiListFromSet( + not_null document); Set *FeedSet(const MTPDstickerSet &data); Set *FeedSetFull(const MTPmessages_StickerSet &data); diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp index 7f175cea07..6b8650feab 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp @@ -60,7 +60,7 @@ struct StickerIcon { class StickersListWidget::Footer : public TabbedSelector::InnerFooter, private base::Subscriber { public: - Footer(gsl::not_null parent); + Footer(not_null parent); void preloadImages(); void validateSelectedIcon(uint64 setId, ValidateIconAnimations animations); @@ -88,7 +88,7 @@ private: void paintStickerSettingsIcon(Painter &p) const; void paintFeaturedStickerSetsBadge(Painter &p, int iconLeft) const; - gsl::not_null _pan; + not_null _pan; static constexpr auto kVisibleIconsCount = 8; @@ -111,7 +111,7 @@ private: }; -StickersListWidget::Footer::Footer(gsl::not_null parent) : InnerFooter(parent) +StickersListWidget::Footer::Footer(not_null parent) : InnerFooter(parent) , _pan(parent) , _a_icons(animation(this, &Footer::step_icons)) { setMouseTracking(true); @@ -434,7 +434,7 @@ void StickersListWidget::Footer::step_icons(TimeMs ms, bool timer) { } } -StickersListWidget::StickersListWidget(QWidget *parent, gsl::not_null controller) : Inner(parent, controller) +StickersListWidget::StickersListWidget(QWidget *parent, not_null controller) : Inner(parent, controller) , _section(Section::Stickers) , _megagroupSetAbout(st::emojiPanWidth - st::emojiScroll.width - st::emojiPanHeaderLeft) , _addText(lang(lng_stickers_featured_add).toUpper()) diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.h b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.h index c92ab2cb8d..4b27588e10 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.h +++ b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.h @@ -39,7 +39,7 @@ class StickersListWidget : public TabbedSelector::Inner, private base::Subscribe Q_OBJECT public: - StickersListWidget(QWidget *parent, gsl::not_null controller); + StickersListWidget(QWidget *parent, not_null controller); void refreshRecent() override; void preloadImages() override; diff --git a/Telegram/SourceFiles/chat_helpers/tabbed_panel.cpp b/Telegram/SourceFiles/chat_helpers/tabbed_panel.cpp index a18c2818c5..84b8118f85 100644 --- a/Telegram/SourceFiles/chat_helpers/tabbed_panel.cpp +++ b/Telegram/SourceFiles/chat_helpers/tabbed_panel.cpp @@ -34,10 +34,10 @@ constexpr auto kDelayedHideTimeoutMs = 3000; } // namespace -TabbedPanel::TabbedPanel(QWidget *parent, gsl::not_null controller) : TabbedPanel(parent, controller, object_ptr(nullptr, controller)) { +TabbedPanel::TabbedPanel(QWidget *parent, not_null controller) : TabbedPanel(parent, controller, object_ptr(nullptr, controller)) { } -TabbedPanel::TabbedPanel(QWidget *parent, gsl::not_null controller, object_ptr selector) : TWidget(parent) +TabbedPanel::TabbedPanel(QWidget *parent, not_null controller, object_ptr selector) : TWidget(parent) , _controller(controller) , _selector(std::move(selector)) { _selector->setParent(this); diff --git a/Telegram/SourceFiles/chat_helpers/tabbed_panel.h b/Telegram/SourceFiles/chat_helpers/tabbed_panel.h index fcbfa57226..32438d3022 100644 --- a/Telegram/SourceFiles/chat_helpers/tabbed_panel.h +++ b/Telegram/SourceFiles/chat_helpers/tabbed_panel.h @@ -39,8 +39,8 @@ class TabbedPanel : public TWidget { Q_OBJECT public: - TabbedPanel(QWidget *parent, gsl::not_null controller); - TabbedPanel(QWidget *parent, gsl::not_null controller, object_ptr selector); + TabbedPanel(QWidget *parent, not_null controller); + TabbedPanel(QWidget *parent, not_null controller, object_ptr selector); object_ptr takeSelector(); QPointer getSelector() const; @@ -106,7 +106,7 @@ private: bool preventAutoHide() const; void updateContentHeight(); - gsl::not_null _controller; + not_null _controller; object_ptr _selector; int _contentMaxHeight = 0; diff --git a/Telegram/SourceFiles/chat_helpers/tabbed_section.cpp b/Telegram/SourceFiles/chat_helpers/tabbed_section.cpp index bdf839b47d..5826c1ab2d 100644 --- a/Telegram/SourceFiles/chat_helpers/tabbed_section.cpp +++ b/Telegram/SourceFiles/chat_helpers/tabbed_section.cpp @@ -25,10 +25,10 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org namespace ChatHelpers { -TabbedSection::TabbedSection(QWidget *parent, gsl::not_null controller) : TabbedSection(parent, controller, object_ptr(this, controller)) { +TabbedSection::TabbedSection(QWidget *parent, not_null controller) : TabbedSection(parent, controller, object_ptr(this, controller)) { } -TabbedSection::TabbedSection(QWidget *parent, gsl::not_null controller, object_ptr selector) : Window::AbstractSectionWidget(parent, controller) +TabbedSection::TabbedSection(QWidget *parent, not_null controller, object_ptr selector) : Window::AbstractSectionWidget(parent, controller) , _selector(std::move(selector)) { resize(st::emojiPanWidth, st::emojiPanMaxHeight); diff --git a/Telegram/SourceFiles/chat_helpers/tabbed_section.h b/Telegram/SourceFiles/chat_helpers/tabbed_section.h index 2b78cbda2f..b155fe88bc 100644 --- a/Telegram/SourceFiles/chat_helpers/tabbed_section.h +++ b/Telegram/SourceFiles/chat_helpers/tabbed_section.h @@ -28,8 +28,8 @@ class TabbedSelector; class TabbedSection : public Window::AbstractSectionWidget { public: - TabbedSection(QWidget *parent, gsl::not_null controller); - TabbedSection(QWidget *parent, gsl::not_null controller, object_ptr selector); + TabbedSection(QWidget *parent, not_null controller); + TabbedSection(QWidget *parent, not_null controller, object_ptr selector); void beforeHiding(); void afterShown(); diff --git a/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp b/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp index df119ddfff..81d1873e2a 100644 --- a/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp +++ b/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp @@ -285,7 +285,7 @@ void TabbedSelector::Tab::saveScrollTop() { _scrollTop = widget()->getVisibleTop(); } -TabbedSelector::TabbedSelector(QWidget *parent, gsl::not_null controller) : TWidget(parent) +TabbedSelector::TabbedSelector(QWidget *parent, not_null controller) : TWidget(parent) , _tabsSlider(this, st::emojiTabs) , _topShadow(this, st::shadowFg) , _bottomShadow(this, st::shadowFg) @@ -669,15 +669,15 @@ void TabbedSelector::switchTab() { Auth().saveDataDelayed(kSaveChosenTabTimeout); } -gsl::not_null TabbedSelector::emoji() const { +not_null TabbedSelector::emoji() const { return static_cast(getTab(SelectorTab::Emoji)->widget().get()); } -gsl::not_null TabbedSelector::stickers() const { +not_null TabbedSelector::stickers() const { return static_cast(getTab(SelectorTab::Stickers)->widget().get()); } -gsl::not_null TabbedSelector::gifs() const { +not_null TabbedSelector::gifs() const { return static_cast(getTab(SelectorTab::Gifs)->widget().get()); } @@ -697,7 +697,7 @@ void TabbedSelector::scrollToY(int y) { _topShadow->update(); } -TabbedSelector::Inner::Inner(QWidget *parent, gsl::not_null controller) : TWidget(parent) +TabbedSelector::Inner::Inner(QWidget *parent, not_null controller) : TWidget(parent) , _controller(controller) { } diff --git a/Telegram/SourceFiles/chat_helpers/tabbed_selector.h b/Telegram/SourceFiles/chat_helpers/tabbed_selector.h index d773eacec9..b03d6d2f40 100644 --- a/Telegram/SourceFiles/chat_helpers/tabbed_selector.h +++ b/Telegram/SourceFiles/chat_helpers/tabbed_selector.h @@ -56,7 +56,7 @@ class TabbedSelector : public TWidget, private base::Subscriber { Q_OBJECT public: - TabbedSelector(QWidget *parent, gsl::not_null controller); + TabbedSelector(QWidget *parent, not_null controller); void setRoundRadius(int radius); void refreshStickers(); @@ -123,10 +123,10 @@ private: SelectorTab type() const { return _type; } - gsl::not_null widget() const { + not_null widget() const { return _weak; } - gsl::not_null footer() const { + not_null footer() const { return _footer; } @@ -164,21 +164,21 @@ private: void setWidgetToScrollArea(); void createTabsSlider(); void switchTab(); - gsl::not_null getTab(SelectorTab type) { + not_null getTab(SelectorTab type) { return &_tabs[static_cast(type)]; } - gsl::not_null getTab(SelectorTab type) const { + not_null getTab(SelectorTab type) const { return &_tabs[static_cast(type)]; } - gsl::not_null currentTab() { + not_null currentTab() { return getTab(_currentTabType); } - gsl::not_null currentTab() const { + not_null currentTab() const { return getTab(_currentTabType); } - gsl::not_null emoji() const; - gsl::not_null stickers() const; - gsl::not_null gifs() const; + not_null emoji() const; + not_null stickers() const; + not_null gifs() const; int _roundRadius = 0; int _footerTop = 0; @@ -205,7 +205,7 @@ class TabbedSelector::Inner : public TWidget { Q_OBJECT public: - Inner(QWidget *parent, gsl::not_null controller); + Inner(QWidget *parent, not_null controller); void setVisibleTopBottom(int visibleTop, int visibleBottom) override; @@ -235,7 +235,7 @@ signals: void disableScroll(bool disabled); protected: - gsl::not_null controller() const { + not_null controller() const { return _controller; } @@ -247,7 +247,7 @@ protected: } private: - gsl::not_null _controller; + not_null _controller; int _visibleTop = 0; int _visibleBottom = 0; diff --git a/Telegram/SourceFiles/core/basic_types.h b/Telegram/SourceFiles/core/basic_types.h index 859672224c..fa4f93f8f9 100644 --- a/Telegram/SourceFiles/core/basic_types.h +++ b/Telegram/SourceFiles/core/basic_types.h @@ -27,6 +27,9 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org #include "base/build_config.h" +template +using not_null = gsl::not_null; + // Custom libc++ build used for old OS X versions already has this. #ifndef OS_MAC_OLD diff --git a/Telegram/SourceFiles/core/utils.h b/Telegram/SourceFiles/core/utils.h index a214a8b784..3c729513d2 100644 --- a/Telegram/SourceFiles/core/utils.h +++ b/Telegram/SourceFiles/core/utils.h @@ -415,7 +415,7 @@ inline void memsetrnd_bad(T &value) { class ReadLockerAttempt { public: - ReadLockerAttempt(gsl::not_null lock) : _lock(lock), _locked(_lock->tryLockForRead()) { + ReadLockerAttempt(not_null lock) : _lock(lock), _locked(_lock->tryLockForRead()) { } ReadLockerAttempt(const ReadLockerAttempt &other) = delete; ReadLockerAttempt &operator=(const ReadLockerAttempt &other) = delete; @@ -437,7 +437,7 @@ public: } private: - gsl::not_null _lock; + not_null _lock; bool _locked = false; }; diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp index bbde3305cc..46ec6f733d 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp @@ -65,7 +65,7 @@ struct DialogsInner::PeerSearchResult { Dialogs::RippleRow row; }; -DialogsInner::DialogsInner(QWidget *parent, gsl::not_null controller, QWidget *main) : SplittedWidget(parent) +DialogsInner::DialogsInner(QWidget *parent, not_null controller, QWidget *main) : SplittedWidget(parent) , _controller(controller) , _dialogs(std::make_unique(Dialogs::SortMode::Date)) , _contactsNoDialogs(std::make_unique(Dialogs::SortMode::Name)) @@ -464,7 +464,7 @@ void DialogsInner::paintSearchInPeer(Painter &p, int fullWidth, bool onlyBackgro } } -void DialogsInner::paintSearchInFilter(Painter &p, gsl::not_null peer, int top, int fullWidth, const Text &text) const { +void DialogsInner::paintSearchInFilter(Painter &p, not_null peer, int top, int fullWidth, const Text &text) const { auto pen = p.pen(); 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 peer, const PeerData::Names &oldNames, const PeerData::NameFirstChars &oldChars) { +void DialogsInner::handlePeerNameChange(not_null peer, const PeerData::Names &oldNames, const PeerData::NameFirstChars &oldChars) { _dialogs->peerNameChanged(Dialogs::Mode::All, peer, oldNames, oldChars); if (_dialogsImportant) { _dialogsImportant->peerNameChanged(Dialogs::Mode::Important, peer, oldNames, oldChars); diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.h b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.h index b15cab9eb8..962a1e8905 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.h +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.h @@ -42,7 +42,7 @@ class DialogsInner : public Ui::SplittedWidget, public RPCSender, private base:: Q_OBJECT public: - DialogsInner(QWidget *parent, gsl::not_null controller, QWidget *main); + DialogsInner(QWidget *parent, not_null controller, QWidget *main); void dialogsReceived(const QVector &dialogs); void addSavedPeersAfter(const QDateTime &date); @@ -170,7 +170,7 @@ private: bool isSelected() const { return _importantSwitchSelected || _selected || (_hashtagSelected >= 0) || (_filteredSelected >= 0) || (_peerSearchSelected >= 0) || (_searchedSelected >= 0); } - void handlePeerNameChange(gsl::not_null peer, const PeerData::Names &oldNames, const PeerData::NameFirstChars &oldChars); + void handlePeerNameChange(not_null peer, const PeerData::Names &oldNames, const PeerData::NameFirstChars &oldChars); void itemRemoved(HistoryItem *item); 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 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 paintSearchInFilter(Painter &p, gsl::not_null peer, int top, int fullWidth, const Text &text) const; + void paintSearchInFilter(Painter &p, not_null peer, int top, int fullWidth, const Text &text) const; void clearSelection(); void clearSearchResults(bool clearPeerSearchResults = true); @@ -213,7 +213,7 @@ private: void savePinnedOrder(); void step_pinnedShifting(TimeMs ms, bool timer); - gsl::not_null _controller; + not_null _controller; DialogsList _dialogs; DialogsList _dialogsImportant; diff --git a/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.cpp b/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.cpp index a82382d575..43d0e38d12 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.cpp @@ -27,7 +27,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org namespace Dialogs { -void ShowSearchFromBox(PeerData *peer, base::lambda)> callback, base::lambda closedCallback) { +void ShowSearchFromBox(PeerData *peer, base::lambda)> callback, base::lambda closedCallback) { auto createController = [peer, callback = std::move(callback)]() -> std::unique_ptr { if (peer) { if (auto chat = peer->asChat()) { @@ -40,14 +40,14 @@ void ShowSearchFromBox(PeerData *peer, base::lambda(); - auto box = Ui::show(Box(std::move(controller), [subscription](gsl::not_null box) { + auto box = Ui::show(Box(std::move(controller), [subscription](not_null box) { box->addButton(langFactory(lng_cancel), [box, subscription] { box->closeBox(); }); }), KeepOtherLayers); *subscription = box->boxClosing.add_subscription(std::move(closedCallback)); } } -ChatSearchFromController::ChatSearchFromController(gsl::not_null chat, base::lambda)> callback) : PeerListController() +ChatSearchFromController::ChatSearchFromController(not_null chat, base::lambda)> callback) : PeerListController() , _chat(chat) , _callback(std::move(callback)) { } @@ -66,7 +66,7 @@ void ChatSearchFromController::prepare() { })); } -void ChatSearchFromController::rowClicked(gsl::not_null row) { +void ChatSearchFromController::rowClicked(not_null row) { Expects(row->peer()->isUser()); _callback(row->peer()->asUser()); } @@ -109,13 +109,13 @@ void ChatSearchFromController::checkForEmptyRows() { } } -void ChatSearchFromController::appendRow(gsl::not_null user) { +void ChatSearchFromController::appendRow(not_null user) { if (!delegate()->peerListFindRow(user->id)) { delegate()->peerListAppendRow(std::make_unique(user)); } } -ChannelSearchFromController::ChannelSearchFromController(gsl::not_null channel, base::lambda)> callback) : ParticipantsBoxController(channel, ParticipantsBoxController::Role::Members) +ChannelSearchFromController::ChannelSearchFromController(not_null channel, base::lambda)> callback) : ParticipantsBoxController(channel, ParticipantsBoxController::Role::Members) , _callback(std::move(callback)) { } @@ -124,12 +124,12 @@ void ChannelSearchFromController::prepare() { delegate()->peerListSetTitle(langFactory(lng_search_messages_from)); } -void ChannelSearchFromController::rowClicked(gsl::not_null row) { +void ChannelSearchFromController::rowClicked(not_null row) { Expects(row->peer()->isUser()); _callback(row->peer()->asUser()); } -std::unique_ptr ChannelSearchFromController::createRow(gsl::not_null user) const { +std::unique_ptr ChannelSearchFromController::createRow(not_null user) const { return std::make_unique(user); } diff --git a/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.h b/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.h index febcaac883..bebccb5e01 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.h +++ b/Telegram/SourceFiles/dialogs/dialogs_search_from_controllers.h @@ -25,37 +25,37 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org namespace Dialogs { -void ShowSearchFromBox(PeerData *peer, base::lambda)> callback, base::lambda closedCallback); +void ShowSearchFromBox(PeerData *peer, base::lambda)> callback, base::lambda closedCallback); class ChatSearchFromController : public PeerListController, protected base::Subscriber { public: - ChatSearchFromController(gsl::not_null chat, base::lambda)> callback); + ChatSearchFromController(not_null chat, base::lambda)> callback); void prepare() override; - void rowClicked(gsl::not_null row) override; + void rowClicked(not_null row) override; private: void rebuildRows(); void checkForEmptyRows(); - void appendRow(gsl::not_null user); + void appendRow(not_null user); - gsl::not_null _chat; - base::lambda)> _callback; + not_null _chat; + base::lambda)> _callback; }; class ChannelSearchFromController : public Profile::ParticipantsBoxController { public: - ChannelSearchFromController(gsl::not_null channel, base::lambda)> callback); + ChannelSearchFromController(not_null channel, base::lambda)> callback); void prepare() override; - void rowClicked(gsl::not_null row) override; + void rowClicked(not_null row) override; protected: - std::unique_ptr createRow(gsl::not_null user) const override; + std::unique_ptr createRow(not_null user) const override; private: - base::lambda)> _callback; + base::lambda)> _callback; }; diff --git a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp index 4730107b98..f9d017ebcd 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp @@ -91,7 +91,7 @@ void DialogsWidget::UpdateButton::paintEvent(QPaintEvent *e) { } } -DialogsWidget::DialogsWidget(QWidget *parent, gsl::not_null controller) : Window::AbstractSectionWidget(parent, controller) +DialogsWidget::DialogsWidget(QWidget *parent, not_null controller) : Window::AbstractSectionWidget(parent, controller) , _mainMenuToggle(this, st::dialogsMenuToggle) , _filter(this, st::dialogsFilter, langFactory(lng_dlg_filter)) , _chooseFromUser(this, object_ptr(this, st::dialogsSearchFrom)) @@ -870,7 +870,7 @@ void DialogsWidget::clearSearchCache() { void DialogsWidget::showSearchFrom() { auto peer = _searchInPeer; - Dialogs::ShowSearchFromBox(peer, base::lambda_guarded(this, [this, peer](gsl::not_null user) { + Dialogs::ShowSearchFromBox(peer, base::lambda_guarded(this, [this, peer](not_null user) { Ui::hideLayer(); setSearchInPeer(peer, user); onFilterUpdate(true); diff --git a/Telegram/SourceFiles/dialogs/dialogs_widget.h b/Telegram/SourceFiles/dialogs/dialogs_widget.h index bfb188b01a..1f0b27a916 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_widget.h +++ b/Telegram/SourceFiles/dialogs/dialogs_widget.h @@ -59,7 +59,7 @@ class DialogsWidget : public Window::AbstractSectionWidget, public RPCSender { Q_OBJECT public: - DialogsWidget(QWidget *parent, gsl::not_null controller); + DialogsWidget(QWidget *parent, not_null controller); void updateDragInScroll(bool inScroll); diff --git a/Telegram/SourceFiles/facades.cpp b/Telegram/SourceFiles/facades.cpp index ae66c1806f..76e0080717 100644 --- a/Telegram/SourceFiles/facades.cpp +++ b/Telegram/SourceFiles/facades.cpp @@ -241,7 +241,7 @@ bool isLayerShown() { return false; } -void repaintHistoryItem(gsl::not_null item) { +void repaintHistoryItem(not_null item) { if (auto main = App::main()) { main->ui_repaintHistoryItem(item); } diff --git a/Telegram/SourceFiles/facades.h b/Telegram/SourceFiles/facades.h index 6959df99f6..287dd7dba9 100644 --- a/Telegram/SourceFiles/facades.h +++ b/Telegram/SourceFiles/facades.h @@ -104,7 +104,7 @@ void hideLayer(bool fast = false); void hideSettingsAndLayer(bool fast = false); bool isLayerShown(); -void repaintHistoryItem(gsl::not_null item); +void repaintHistoryItem(not_null item); void autoplayMediaInlineAsync(const FullMsgId &msgId); void showPeerProfile(const PeerId &peer); diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp index 19609499aa..60053989f4 100644 --- a/Telegram/SourceFiles/history/history.cpp +++ b/Telegram/SourceFiles/history/history.cpp @@ -764,7 +764,7 @@ void Histories::savePinnedToServer() const { MTP::send(MTPmessages_ReorderPinnedDialogs(MTP_flags(flags), MTP_vector(peers))); } -void Histories::selfDestructIn(gsl::not_null item, TimeMs delay) { +void Histories::selfDestructIn(not_null item, TimeMs delay) { _selfDestructItems.push_back(item->fullId()); if (!_selfDestructTimer.isActive() || _selfDestructTimer.remainingTime() > delay) { _selfDestructTimer.callOnce(delay); @@ -1257,7 +1257,7 @@ HistoryItem *History::addNewItem(HistoryItem *adding, bool newMsg) { adding->addToOverview(AddToOverviewNew); if (adding->from()->id) { if (auto user = adding->from()->asUser()) { - auto getLastAuthors = [this]() -> QList>* { + auto getLastAuthors = [this]() -> QList>* { if (auto chat = peer->asChat()) { return &chat->lastAuthors; } else if (auto channel = peer->asMegagroup()) { @@ -1291,7 +1291,7 @@ HistoryItem *History::addNewItem(HistoryItem *adding, bool newMsg) { if (adding->definesReplyKeyboard()) { auto markupFlags = adding->replyKeyboardFlags(); if (!(markupFlags & MTPDreplyKeyboardMarkup::Flag::f_selective) || adding->mentionsMe()) { - auto getMarkupSenders = [this]() -> OrderedSet>* { + auto getMarkupSenders = [this]() -> OrderedSet>* { if (auto chat = peer->asChat()) { return &chat->markupSenders; } else if (auto channel = peer->asMegagroup()) { @@ -1444,8 +1444,8 @@ void History::addOlderSlice(const QVector &slice) { } else if (loadedAtBottom()) { // add photos to overview and authors to lastAuthors bool channel = isChannel(); int32 mask = 0; - QList> *lastAuthors = nullptr; - OrderedSet> *markupSenders = nullptr; + QList> *lastAuthors = nullptr; + OrderedSet> *markupSenders = nullptr; if (peer->isChat()) { lastAuthors = &peer->asChat()->lastAuthors; markupSenders = &peer->asChat()->markupSenders; diff --git a/Telegram/SourceFiles/history/history.h b/Telegram/SourceFiles/history/history.h index e38a38ca80..0c0b56aaba 100644 --- a/Telegram/SourceFiles/history/history.h +++ b/Telegram/SourceFiles/history/history.h @@ -31,7 +31,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org void HistoryInit(); class HistoryItem; -using SelectedItemSet = QMap>; +using SelectedItemSet = QMap>; enum NewMessageType { NewMessageUnread, @@ -99,7 +99,7 @@ public: base::Observable &sendActionAnimationUpdated() { return _sendActionAnimationUpdated; } - void selfDestructIn(gsl::not_null item, TimeMs delay); + void selfDestructIn(not_null item, TimeMs delay); private: void checkSelfDestructItems(); @@ -646,7 +646,7 @@ private: class HistoryBlock { public: - HistoryBlock(gsl::not_null history) : _history(history) { + HistoryBlock(not_null history) : _history(history) { } HistoryBlock(const HistoryBlock &) = delete; @@ -670,7 +670,7 @@ public: int height() const { return _height; } - gsl::not_null history() const { + not_null history() const { return _history; } @@ -696,7 +696,7 @@ public: } protected: - const gsl::not_null _history; + const not_null _history; int _y = 0; int _height = 0; diff --git a/Telegram/SourceFiles/history/history_admin_log_filter.cpp b/Telegram/SourceFiles/history/history_admin_log_filter.cpp index 02759901ad..c27f8daec0 100644 --- a/Telegram/SourceFiles/history/history_admin_log_filter.cpp +++ b/Telegram/SourceFiles/history/history_admin_log_filter.cpp @@ -30,7 +30,7 @@ namespace { class UserCheckbox : public Ui::RippleButton { public: - UserCheckbox(QWidget *parent, gsl::not_null user, bool checked); + UserCheckbox(QWidget *parent, not_null user, bool checked); bool checked() const { return _check->checked(); @@ -63,13 +63,13 @@ private: QRect _checkRect; - gsl::not_null _user; + not_null _user; QString _statusText; bool _statusOnline = false; }; -UserCheckbox::UserCheckbox(QWidget *parent, gsl::not_null user, bool checked) : Ui::RippleButton(parent, st::defaultBoxCheckbox.ripple) +UserCheckbox::UserCheckbox(QWidget *parent, not_null user, bool checked) : Ui::RippleButton(parent, st::defaultBoxCheckbox.ripple) , _st(st::adminLogFilterUserCheckbox) , _check(std::make_unique(st::defaultCheck, checked, [this] { rtlupdate(_checkRect); })) , _user(user) { @@ -146,7 +146,7 @@ QPoint UserCheckbox::prepareRippleStartPosition() const { class FilterBox::Inner : public TWidget, private base::Subscriber { public: - Inner(QWidget *parent, gsl::not_null channel, const std::vector> &admins, const FilterValue &filter, base::lambda changedCallback); + Inner(QWidget *parent, not_null channel, const std::vector> &admins, const FilterValue &filter, base::lambda changedCallback); template QPointer addRow(object_ptr widget, int marginTop) { @@ -167,19 +167,19 @@ protected: void resizeEvent(QResizeEvent *e) override; private: - void createControls(const std::vector> &admins, const FilterValue &filter); + void createControls(const std::vector> &admins, const FilterValue &filter); void createAllActionsCheckbox(const FilterValue &filter); void createActionsCheckboxes(const FilterValue &filter); void createAllUsersCheckbox(const FilterValue &filter); - void createAdminsCheckboxes(const std::vector> &admins, const FilterValue &filter); + void createAdminsCheckboxes(const std::vector> &admins, const FilterValue &filter); - gsl::not_null _channel; + not_null _channel; QPointer _allFlags; QMap> _filterFlags; QPointer _allUsers; - QMap, QPointer> _admins; + QMap, QPointer> _admins; bool _restoringInvariant = false; struct Row { @@ -192,13 +192,13 @@ private: }; -FilterBox::Inner::Inner(QWidget *parent, gsl::not_null channel, const std::vector> &admins, const FilterValue &filter, base::lambda changedCallback) : TWidget(parent) +FilterBox::Inner::Inner(QWidget *parent, not_null channel, const std::vector> &admins, const FilterValue &filter, base::lambda changedCallback) : TWidget(parent) , _channel(channel) , _changedCallback(std::move(changedCallback)) { createControls(admins, filter); } -void FilterBox::Inner::createControls(const std::vector> &admins, const FilterValue &filter) { +void FilterBox::Inner::createControls(const std::vector> &admins, const FilterValue &filter) { createAllActionsCheckbox(filter); createActionsCheckboxes(filter); createAllUsersCheckbox(filter); @@ -276,7 +276,7 @@ void FilterBox::Inner::createAllUsersCheckbox(const FilterValue &filter) { }); } -void FilterBox::Inner::createAdminsCheckboxes(const std::vector> &admins, const FilterValue &filter) { +void FilterBox::Inner::createAdminsCheckboxes(const std::vector> &admins, const FilterValue &filter) { for (auto user : admins) { auto checked = filter.allUsers || base::contains(filter.admins, user); auto checkbox = addRow(object_ptr(this, user, checked), st::adminLogFilterLittleSkip); @@ -356,7 +356,7 @@ void FilterBox::Inner::resizeEvent(QResizeEvent *e) { } } -FilterBox::FilterBox(QWidget*, gsl::not_null channel, const std::vector> &admins, const FilterValue &filter, base::lambda saveCallback) : BoxContent() +FilterBox::FilterBox(QWidget*, not_null channel, const std::vector> &admins, const FilterValue &filter, base::lambda saveCallback) : BoxContent() , _channel(channel) , _admins(admins) , _initialFilter(filter) diff --git a/Telegram/SourceFiles/history/history_admin_log_filter.h b/Telegram/SourceFiles/history/history_admin_log_filter.h index 6c89a537f5..b79a0d839e 100644 --- a/Telegram/SourceFiles/history/history_admin_log_filter.h +++ b/Telegram/SourceFiles/history/history_admin_log_filter.h @@ -27,7 +27,7 @@ namespace AdminLog { class FilterBox : public BoxContent { public: - FilterBox(QWidget*, gsl::not_null channel, const std::vector> &admins, const FilterValue &filter, base::lambda saveCallback); + FilterBox(QWidget*, not_null channel, const std::vector> &admins, const FilterValue &filter, base::lambda saveCallback); protected: void prepare() override; @@ -36,8 +36,8 @@ private: void resizeToContent(); void refreshButtons(); - gsl::not_null _channel; - std::vector> _admins; + not_null _channel; + std::vector> _admins; FilterValue _initialFilter; base::lambda _saveCallback; diff --git a/Telegram/SourceFiles/history/history_admin_log_inner.cpp b/Telegram/SourceFiles/history/history_admin_log_inner.cpp index 6011b84440..bd714042a2 100644 --- a/Telegram/SourceFiles/history/history_admin_log_inner.cpp +++ b/Telegram/SourceFiles/history/history_admin_log_inner.cpp @@ -205,7 +205,7 @@ void InnerWidget::enumerateDates(Method method) { enumerateItems(dateCallback); } -InnerWidget::InnerWidget(QWidget *parent, gsl::not_null controller, gsl::not_null channel) : TWidget(parent) +InnerWidget::InnerWidget(QWidget *parent, not_null controller, not_null channel) : TWidget(parent) , _controller(controller) , _channel(channel) , _history(App::history(channel)) @@ -213,7 +213,7 @@ InnerWidget::InnerWidget(QWidget *parent, gsl::not_null con , _emptyText(st::historyAdminLogEmptyWidth - st::historyAdminLogEmptyPadding.left() - st::historyAdminLogEmptyPadding.left()) { setMouseTracking(true); _scrollDateHideTimer.setCallback([this] { scrollDateHideByTimer(); }); - subscribe(Auth().data().repaintLogEntry(), [this](gsl::not_null historyItem) { + subscribe(Auth().data().repaintLogEntry(), [this](not_null historyItem) { if (_history == historyItem->history()) { repaintItem(historyItem); } @@ -421,7 +421,7 @@ QPoint InnerWidget::tooltipPos() const { return _mousePosition; } -void InnerWidget::saveState(gsl::not_null memento) { +void InnerWidget::saveState(not_null memento) { memento->setFilter(std::move(_filter)); memento->setAdmins(std::move(_admins)); memento->setAdminsCanEdit(std::move(_adminsCanEdit)); @@ -433,7 +433,7 @@ void InnerWidget::saveState(gsl::not_null memento) { _upLoaded = _downLoaded = true; // Don't load or handle anything anymore. } -void InnerWidget::restoreState(gsl::not_null memento) { +void InnerWidget::restoreState(not_null memento) { _items = memento->takeItems(); _itemsByIds = memento->takeItemsByIds(); _idManager = memento->takeIdManager(); @@ -635,7 +635,7 @@ void InnerWidget::paintEvent(QPaintEvent *e) { } p.translate(0, -top); - enumerateUserpics([&p, &clip](gsl::not_null message, int userpicTop) { + enumerateUserpics([&p, &clip](not_null message, int userpicTop) { // stop the enumeration if the userpic is below the painted rect if (userpicTop >= clip.top() + clip.height()) { return false; @@ -650,7 +650,7 @@ void InnerWidget::paintEvent(QPaintEvent *e) { auto dateHeight = st::msgServicePadding.bottom() + st::msgServiceFont->height + st::msgServicePadding.top(); auto scrollDateOpacity = _scrollDateOpacity.current(ms, _scrollDateShown ? 1. : 0.); - enumerateDates([&p, &clip, scrollDateOpacity, dateHeight/*, lastDate, showFloatingBefore*/](gsl::not_null item, int itemtop, int dateTop) { + enumerateDates([&p, &clip, scrollDateOpacity, dateHeight/*, lastDate, showFloatingBefore*/](not_null item, int itemtop, int dateTop) { // stop the enumeration if the date is above the painted rect if (dateTop + dateHeight <= clip.top()) { return false; @@ -1008,7 +1008,7 @@ void InnerWidget::setToClipboard(const TextWithEntities &forClipboard, QClipboar } } -void InnerWidget::suggestRestrictUser(gsl::not_null user) { +void InnerWidget::suggestRestrictUser(not_null user) { Expects(_menu != nullptr); if (!_channel->isMegagroup() || !_channel->canBanMembers() || _admins.empty()) { return; @@ -1054,7 +1054,7 @@ void InnerWidget::suggestRestrictUser(gsl::not_null user) { }); } -void InnerWidget::restrictUser(gsl::not_null user, const MTPChannelBannedRights &oldRights, const MTPChannelBannedRights &newRights) { +void InnerWidget::restrictUser(not_null user, const MTPChannelBannedRights &oldRights, const MTPChannelBannedRights &newRights) { auto weak = QPointer(this); MTP::send(MTPchannels_EditBanned(_channel->inputChannel, user->inputUser, newRights), rpcDone([megagroup = _channel.get(), user, weak, oldRights, newRights](const MTPUpdates &result) { Auth().api().applyUpdates(result); @@ -1065,7 +1065,7 @@ void InnerWidget::restrictUser(gsl::not_null user, const MTPChannelBa })); } -void InnerWidget::restrictUserDone(gsl::not_null user, const MTPChannelBannedRights &rights) { +void InnerWidget::restrictUserDone(not_null user, const MTPChannelBannedRights &rights) { Expects(rights.type() == mtpc_channelBannedRights); if (rights.c_channelBannedRights().vflags.v) { _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 (auto message = item->toHistoryMessage()) { if (message->hasFromPhoto()) { - enumerateUserpics([&dragState, &lnkhost, &point](gsl::not_null message, int userpicTop) -> bool { + enumerateUserpics([&dragState, &lnkhost, &point](not_null message, int userpicTop) -> bool { // stop enumeration if the userpic is below our point if (userpicTop > point.y()) { return false; @@ -1468,7 +1468,7 @@ void InnerWidget::performDrag() { //} // TODO } -int InnerWidget::itemTop(gsl::not_null item) const { +int InnerWidget::itemTop(not_null item) const { return _itemsTop + item->y(); } diff --git a/Telegram/SourceFiles/history/history_admin_log_inner.h b/Telegram/SourceFiles/history/history_admin_log_inner.h index b79cf2bc89..b9a427c40a 100644 --- a/Telegram/SourceFiles/history/history_admin_log_inner.h +++ b/Telegram/SourceFiles/history/history_admin_log_inner.h @@ -40,13 +40,13 @@ class SectionMemento; class InnerWidget final : public TWidget, public Ui::AbstractTooltipShower, private MTP::Sender, private base::Subscriber { public: - InnerWidget(QWidget *parent, gsl::not_null controller, gsl::not_null channel); + InnerWidget(QWidget *parent, not_null controller, not_null channel); base::Observable showSearchSignal; base::Observable scrollToSignal; base::Observable cancelledSignal; - gsl::not_null channel() const { + not_null channel() const { return _channel; } @@ -61,8 +61,8 @@ public: return TWidget::resizeToWidth(newWidth); } - void saveState(gsl::not_null memento); - void restoreState(gsl::not_null memento); + void saveState(not_null memento); + void restoreState(not_null memento); // Empty "flags" means all events. void applyFilter(FilterValue &&value); @@ -111,7 +111,7 @@ private: void mouseActionCancel(); void updateSelected(); void performDrag(); - int itemTop(gsl::not_null item) const; + int itemTop(not_null item) const; void repaintItem(const HistoryItem *item); QPoint mapPointToItem(QPoint point, const HistoryItem *item) const; void handlePendingHistoryResize(); @@ -129,9 +129,9 @@ private: void copySelectedText(); TextWithEntities getSelectedText() const; void setToClipboard(const TextWithEntities &forClipboard, QClipboard::Mode mode = QClipboard::Clipboard); - void suggestRestrictUser(gsl::not_null user); - void restrictUser(gsl::not_null user, const MTPChannelBannedRights &oldRights, const MTPChannelBannedRights &newRights); - void restrictUserDone(gsl::not_null user, const MTPChannelBannedRights &rights); + void suggestRestrictUser(not_null user); + void restrictUser(not_null user, const MTPChannelBannedRights &oldRights, const MTPChannelBannedRights &newRights); + void restrictUserDone(not_null user, const MTPChannelBannedRights &rights); void requestAdmins(); void checkPreloadMore(); @@ -164,7 +164,7 @@ private: // 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. // - // Method has "bool (*Method)(gsl::not_null message, int userpicTop)" signature + // Method has "bool (*Method)(not_null message, int userpicTop)" signature // if it returns false the enumeration stops immidiately. template void enumerateUserpics(Method method); @@ -172,14 +172,14 @@ private: // 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. // - // Method has "bool (*Method)(gsl::not_null item, int itemtop, int dateTop)" signature + // Method has "bool (*Method)(not_null item, int itemtop, int dateTop)" signature // if it returns false the enumeration stops immidiately. template void enumerateDates(Method method); - gsl::not_null _controller; - gsl::not_null _channel; - gsl::not_null _history; + not_null _controller; + not_null _channel; + not_null _history; std::vector _items; std::map _itemsByIds; int _itemsTop = 0; @@ -235,8 +235,8 @@ private: FilterValue _filter; QString _searchQuery; - std::vector> _admins; - std::vector> _adminsCanEdit; + std::vector> _admins; + std::vector> _adminsCanEdit; base::lambda _showFilterCallback; }; diff --git a/Telegram/SourceFiles/history/history_admin_log_item.cpp b/Telegram/SourceFiles/history/history_admin_log_item.cpp index 918a12483c..2db8252a40 100644 --- a/Telegram/SourceFiles/history/history_admin_log_item.cpp +++ b/Telegram/SourceFiles/history/history_admin_log_item.cpp @@ -113,7 +113,7 @@ const auto CollectChanges = [](auto &phraseMap, auto plusFlags, auto minusFlags) return withPrefix(plusFlags & ~minusFlags, '+') + withPrefix(minusFlags & ~plusFlags, kMinus); }; -auto GenerateAdminChangeText(gsl::not_null channel, const TextWithEntities &user, const MTPChannelAdminRights *newRights, const MTPChannelAdminRights *prevRights) { +auto GenerateAdminChangeText(not_null channel, const TextWithEntities &user, const MTPChannelAdminRights *newRights, const MTPChannelAdminRights *prevRights) { using Flag = MTPDchannelAdminRights::Flag; 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); } -auto GenerateParticipantChangeTextInner(gsl::not_null channel, const MTPChannelParticipant &participant, const MTPChannelParticipant *oldParticipant) { +auto GenerateParticipantChangeTextInner(not_null channel, const MTPChannelParticipant &participant, const MTPChannelParticipant *oldParticipant) { auto oldType = oldParticipant ? oldParticipant->type() : 0; auto resultForParticipant = [channel, oldParticipant, oldType](auto &&data) { @@ -236,7 +236,7 @@ auto GenerateParticipantChangeTextInner(gsl::not_null channel, con Unexpected("Participant type in GenerateParticipantChangeTextInner()"); } -TextWithEntities GenerateParticipantChangeText(gsl::not_null channel, const MTPChannelParticipant &participant, const MTPChannelParticipant *oldParticipant = nullptr) { +TextWithEntities GenerateParticipantChangeText(not_null channel, const MTPChannelParticipant &participant, const MTPChannelParticipant *oldParticipant = nullptr) { auto result = GenerateParticipantChangeTextInner(channel, participant, oldParticipant); result.entities.push_front(EntityInText(EntityInTextItalic, 0, result.text.size())); return result; @@ -244,7 +244,7 @@ TextWithEntities GenerateParticipantChangeText(gsl::not_null chann } // namespace -void GenerateItems(gsl::not_null history, LocalIdManager &idManager, const MTPDchannelAdminLogEvent &event, base::lambda callback) { +void GenerateItems(not_null history, LocalIdManager &idManager, const MTPDchannelAdminLogEvent &event, base::lambda callback) { Expects(history->peer->isChannel()); auto id = event.vid.v; @@ -252,7 +252,7 @@ void GenerateItems(gsl::not_null history, LocalIdManager &idManager, c auto channel = history->peer->asChannel(); auto &action = event.vaction; auto date = event.vdate; - auto addPart = [&callback](gsl::not_null item) { + auto addPart = [&callback](not_null item) { return callback(HistoryItemOwned(item)); }; diff --git a/Telegram/SourceFiles/history/history_admin_log_item.h b/Telegram/SourceFiles/history/history_admin_log_item.h index cd617884d7..d239d0cfd7 100644 --- a/Telegram/SourceFiles/history/history_admin_log_item.h +++ b/Telegram/SourceFiles/history/history_admin_log_item.h @@ -25,12 +25,12 @@ namespace AdminLog { class HistoryItemOwned; class LocalIdManager; -void GenerateItems(gsl::not_null history, LocalIdManager &idManager, const MTPDchannelAdminLogEvent &event, base::lambda callback); +void GenerateItems(not_null history, LocalIdManager &idManager, const MTPDchannelAdminLogEvent &event, base::lambda callback); // Smart pointer wrapper for HistoryItem* that destroys the owned item. class HistoryItemOwned { public: - explicit HistoryItemOwned(gsl::not_null data) : _data(data) { + explicit HistoryItemOwned(not_null data) : _data(data) { } HistoryItemOwned(const HistoryItemOwned &other) = delete; HistoryItemOwned &operator=(const HistoryItemOwned &other) = delete; diff --git a/Telegram/SourceFiles/history/history_admin_log_section.cpp b/Telegram/SourceFiles/history/history_admin_log_section.cpp index 2cfd10cfea..1e1d9175f7 100644 --- a/Telegram/SourceFiles/history/history_admin_log_section.cpp +++ b/Telegram/SourceFiles/history/history_admin_log_section.cpp @@ -41,7 +41,7 @@ namespace AdminLog { class FixedBar final : public TWidget, private base::Subscriber { public: - FixedBar(QWidget *parent, gsl::not_null channel); + FixedBar(QWidget *parent, not_null channel); base::Observable showFilterSignal; base::Observable searchCancelledSignal; @@ -74,7 +74,7 @@ private: void applySearch(); void searchAnimationCallback(); - gsl::not_null _channel; + not_null _channel; object_ptr _field; object_ptr _backButton; object_ptr _search; @@ -88,13 +88,13 @@ private: }; -object_ptr SectionMemento::createWidget(QWidget *parent, gsl::not_null controller, const QRect &geometry) { +object_ptr SectionMemento::createWidget(QWidget *parent, not_null controller, const QRect &geometry) { auto result = object_ptr(parent, controller, _channel); result->setInternalState(geometry, this); return std::move(result); } -FixedBar::FixedBar(QWidget *parent, gsl::not_null channel) : TWidget(parent) +FixedBar::FixedBar(QWidget *parent, not_null channel) : TWidget(parent) , _channel(channel) , _field(this, st::historyAdminLogSearchField, langFactory(lng_dlg_filter)) , _backButton(this, lang(lng_admin_log_title_all)) @@ -232,7 +232,7 @@ void FixedBar::mousePressEvent(QMouseEvent *e) { } } -Widget::Widget(QWidget *parent, gsl::not_null controller, gsl::not_null channel) : Window::SectionWidget(parent, controller) +Widget::Widget(QWidget *parent, not_null controller, not_null channel) : Window::SectionWidget(parent, controller) , _scroll(this, st::historyScroll, false) , _fixedBar(this, channel) , _fixedBarShadow(this, st::shadowFg) @@ -271,7 +271,7 @@ void Widget::updateAdaptiveLayout() { _fixedBarShadow->moveToLeft(Adaptive::OneColumn() ? 0 : st::lineWidth, _fixedBar->height()); } -gsl::not_null Widget::channel() const { +not_null Widget::channel() const { return _inner->channel(); } @@ -288,7 +288,7 @@ void Widget::doSetInnerFocus() { } } -bool Widget::showInternal(gsl::not_null memento) { +bool Widget::showInternal(not_null memento) { if (auto logMemento = dynamic_cast(memento.get())) { if (logMemento->getChannel() == channel()) { restoreState(logMemento); @@ -298,7 +298,7 @@ bool Widget::showInternal(gsl::not_null memento) { return false; } -void Widget::setInternalState(const QRect &geometry, gsl::not_null memento) { +void Widget::setInternalState(const QRect &geometry, not_null memento) { setGeometry(geometry); myEnsureResized(this); restoreState(memento); @@ -318,12 +318,12 @@ std::unique_ptr Widget::createMemento() { return std::move(result); } -void Widget::saveState(gsl::not_null memento) { +void Widget::saveState(not_null memento) { memento->setScrollTop(_scroll->scrollTop()); _inner->saveState(memento); } -void Widget::restoreState(gsl::not_null memento) { +void Widget::restoreState(not_null memento) { _inner->restoreState(memento); auto scrollTop = memento->getScrollTop(); _scroll->scrollToY(scrollTop); diff --git a/Telegram/SourceFiles/history/history_admin_log_section.h b/Telegram/SourceFiles/history/history_admin_log_section.h index d213eec0ae..327f22a4f3 100644 --- a/Telegram/SourceFiles/history/history_admin_log_section.h +++ b/Telegram/SourceFiles/history/history_admin_log_section.h @@ -48,7 +48,7 @@ class SectionMemento; struct FilterValue { // Empty "flags" means all events. MTPDchannelAdminLogEventsFilter::Flags flags = 0; - std::vector> admins; + std::vector> admins; bool allUsers = true; }; @@ -82,9 +82,9 @@ private: class Widget final : public Window::SectionWidget { public: - Widget(QWidget *parent, gsl::not_null controller, gsl::not_null channel); + Widget(QWidget *parent, not_null controller, not_null channel); - gsl::not_null channel() const; + not_null channel() const; PeerData *peerForDialogs() const override { return channel(); } @@ -95,10 +95,10 @@ public: QPixmap grabForShowAnimation(const Window::SectionSlideParams ¶ms) override; - bool showInternal(gsl::not_null memento) override; + bool showInternal(not_null memento) override; std::unique_ptr createMemento() override; - void setInternalState(const QRect &geometry, gsl::not_null memento); + void setInternalState(const QRect &geometry, not_null memento); // Float player interface. bool wheelEventFromFloatPlayer(QEvent *e, Window::Column myColumn, Window::Column playerColumn) override; @@ -120,8 +120,8 @@ private: void showFilter(); void onScroll(); void updateAdaptiveLayout(); - void saveState(gsl::not_null memento); - void restoreState(gsl::not_null memento); + void saveState(not_null memento); + void restoreState(not_null memento); object_ptr _scroll; QPointer _inner; @@ -133,12 +133,12 @@ private: class SectionMemento : public Window::SectionMemento { public: - SectionMemento(gsl::not_null channel) : _channel(channel) { + SectionMemento(not_null channel) : _channel(channel) { } - object_ptr createWidget(QWidget *parent, gsl::not_null controller, const QRect &geometry) override; + object_ptr createWidget(QWidget *parent, not_null controller, const QRect &geometry) override; - gsl::not_null getChannel() const { + not_null getChannel() const { return _channel; } void setScrollTop(int scrollTop) { @@ -148,16 +148,16 @@ public: return _scrollTop; } - void setAdmins(std::vector> admins) { + void setAdmins(std::vector> admins) { _admins = std::move(admins); } - void setAdminsCanEdit(std::vector> admins) { + void setAdminsCanEdit(std::vector> admins) { _adminsCanEdit = std::move(admins); } - std::vector> takeAdmins() { + std::vector> takeAdmins() { return std::move(_admins); } - std::vector> takeAdminsCanEdit() { + std::vector> takeAdminsCanEdit() { return std::move(_adminsCanEdit); } @@ -199,10 +199,10 @@ public: } private: - gsl::not_null _channel; + not_null _channel; int _scrollTop = 0; - std::vector> _admins; - std::vector> _adminsCanEdit; + std::vector> _admins; + std::vector> _adminsCanEdit; std::vector _items; std::map _itemsByIds; bool _upLoaded = false; diff --git a/Telegram/SourceFiles/history/history_inner_widget.cpp b/Telegram/SourceFiles/history/history_inner_widget.cpp index f38402d762..916e20b0d3 100644 --- a/Telegram/SourceFiles/history/history_inner_widget.cpp +++ b/Telegram/SourceFiles/history/history_inner_widget.cpp @@ -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 -HistoryInner::HistoryInner(HistoryWidget *historyWidget, gsl::not_null controller, Ui::ScrollArea *scroll, History *history) : TWidget(nullptr) +HistoryInner::HistoryInner(HistoryWidget *historyWidget, not_null controller, Ui::ScrollArea *scroll, History *history) : TWidget(nullptr) , _controller(controller) , _peer(history->peer) , _migrated(history->peer->migrateFrom() ? App::history(history->peer->migrateFrom()->id) : nullptr) @@ -116,7 +116,7 @@ HistoryInner::HistoryInner(HistoryWidget *historyWidget, gsl::not_nullwindow()->dragFinished(), [this] { mouseActionUpdate(QCursor::pos()); }); - subscribe(Auth().data().historyCleared(), [this](gsl::not_null history) { + subscribe(Auth().data().historyCleared(), [this](not_null history) { if (_history == history) { mouseActionCancel(); } @@ -256,7 +256,7 @@ void HistoryInner::enumerateUserpics(Method method) { // -1 means we didn't find an attached to next message yet. int lowestAttachedItemTop = -1; - auto userpicCallback = [this, &lowestAttachedItemTop, &method](gsl::not_null item, int itemtop, int itembottom) { + auto userpicCallback = [this, &lowestAttachedItemTop, &method](not_null item, int itemtop, int itembottom) { // Skip all service messages. auto message = item->toHistoryMessage(); 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. auto lowestInOneDayItemBottom = -1; - auto dateCallback = [this, &lowestInOneDayItemBottom, &method, drawtop](gsl::not_null item, int itemtop, int itembottom) { + auto dateCallback = [this, &lowestInOneDayItemBottom, &method, drawtop](not_null item, int itemtop, int itembottom) { if (lowestInOneDayItemBottom < 0 && item->isInOneDayWithPrevious()) { lowestInOneDayItemBottom = itembottom - item->marginBottom(); } @@ -506,7 +506,7 @@ void HistoryInner::paintEvent(QPaintEvent *e) { } if (mtop >= 0 || htop >= 0) { - enumerateUserpics([&p, &clip](gsl::not_null message, int userpicTop) { + enumerateUserpics([&p, &clip](not_null message, int userpicTop) { // stop the enumeration if the userpic is below the painted rect if (userpicTop >= clip.top() + clip.height()) { return false; @@ -529,7 +529,7 @@ void HistoryInner::paintEvent(QPaintEvent *e) { //int showFloatingBefore = height() - 2 * (_visibleAreaBottom - _visibleAreaTop) - dateHeight; auto scrollDateOpacity = _scrollDateOpacity.current(ms, _scrollDateShown ? 1. : 0.); - enumerateDates([&p, &clip, scrollDateOpacity, dateHeight/*, lastDate, showFloatingBefore*/](gsl::not_null item, int itemtop, int dateTop) { + enumerateDates([&p, &clip, scrollDateOpacity, dateHeight/*, lastDate, showFloatingBefore*/](not_null item, int itemtop, int dateTop) { // stop the enumeration if the date is above the painted rect if (dateTop + dateHeight <= clip.top()) { return false; @@ -2053,7 +2053,7 @@ void HistoryInner::onUpdateSelected() { auto dateHeight = st::msgServicePadding.bottom() + st::msgServiceFont->height + st::msgServicePadding.top(); auto scrollDateOpacity = _scrollDateOpacity.current(_scrollDateShown ? 1. : 0.); - enumerateDates([this, &dragState, &lnkhost, &point, scrollDateOpacity, dateHeight/*, lastDate, showFloatingBefore*/](gsl::not_null item, int itemtop, int dateTop) { + enumerateDates([this, &dragState, &lnkhost, &point, scrollDateOpacity, dateHeight/*, lastDate, showFloatingBefore*/](not_null item, int itemtop, int dateTop) { // stop enumeration if the date is above our point if (dateTop + dateHeight <= point.y()) { return false; @@ -2112,7 +2112,7 @@ void HistoryInner::onUpdateSelected() { if (!dragState.link && m.x() >= st::historyPhotoLeft && m.x() < st::historyPhotoLeft + st::msgPhotoSize) { if (auto msg = item->toHistoryMessage()) { if (msg->hasFromPhoto()) { - enumerateUserpics([&dragState, &lnkhost, &point](gsl::not_null message, int userpicTop) -> bool { + enumerateUserpics([&dragState, &lnkhost, &point](not_null message, int userpicTop) -> bool { // stop enumeration if the userpic is below our point if (userpicTop > point.y()) { return false; diff --git a/Telegram/SourceFiles/history/history_inner_widget.h b/Telegram/SourceFiles/history/history_inner_widget.h index 728c631c56..0836f4513f 100644 --- a/Telegram/SourceFiles/history/history_inner_widget.h +++ b/Telegram/SourceFiles/history/history_inner_widget.h @@ -37,7 +37,7 @@ class HistoryInner : public TWidget, public Ui::AbstractTooltipShower, private b Q_OBJECT public: - HistoryInner(HistoryWidget *historyWidget, gsl::not_null controller, Ui::ScrollArea *scroll, History *history); + HistoryInner(HistoryWidget *historyWidget, not_null controller, Ui::ScrollArea *scroll, History *history); void messagesReceived(PeerData *peer, const QVector &messages); void messagesReceivedDown(PeerData *peer, const QVector &messages); @@ -166,7 +166,7 @@ private: void scrollDateHide(); void keepScrollDateForNow(); - gsl::not_null _controller; + not_null _controller; PeerData *_peer = nullptr; History *_migrated = nullptr; @@ -274,7 +274,7 @@ private: // 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. // - // Method has "bool (*Method)(gsl::not_null item, int itemtop, int itembottom)" signature + // Method has "bool (*Method)(not_null item, int itemtop, int itembottom)" signature // if it returns false the enumeration stops immidiately. template 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 // for each found userpic (from the top to the bottom) using enumerateItems() method. // - // Method has "bool (*Method)(gsl::not_null message, int userpicTop)" signature + // Method has "bool (*Method)(not_null message, int userpicTop)" signature // if it returns false the enumeration stops immidiately. template void enumerateUserpics(Method method); @@ -302,7 +302,7 @@ private: // 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. // - // Method has "bool (*Method)(gsl::not_null item, int itemtop, int dateTop)" signature + // Method has "bool (*Method)(not_null item, int itemtop, int dateTop)" signature // if it returns false the enumeration stops immidiately. template void enumerateDates(Method method); diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index fda9aa73cd..0b9ad0eb01 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -744,7 +744,7 @@ void HistoryItem::nextItemChanged() { setAttachToNext(false); } -bool HistoryItem::computeIsAttachToPrevious(gsl::not_null previous) { +bool HistoryItem::computeIsAttachToPrevious(not_null previous) { if (!Has() && !Has()) { return !isPost() && !previous->isPost() && !serviceMsg() && !previous->serviceMsg() diff --git a/Telegram/SourceFiles/history/history_item.h b/Telegram/SourceFiles/history/history_item.h index 9e06ff8c33..ec4550a065 100644 --- a/Telegram/SourceFiles/history/history_item.h +++ b/Telegram/SourceFiles/history/history_item.h @@ -299,7 +299,7 @@ public: int buttonHeight() const; virtual int buttonRadius() const = 0; - virtual void repaint(gsl::not_null item) const = 0; + virtual void repaint(not_null item) const = 0; virtual ~Style() { } @@ -907,7 +907,7 @@ public: void clipCallback(Media::Clip::Notification notification); void audioTrackUpdated(); - bool computeIsAttachToPrevious(gsl::not_null previous); + bool computeIsAttachToPrevious(not_null previous); void setLogEntryDisplayDate(bool displayDate) { Expects(isLogEntry()); setDisplayDate(displayDate); @@ -941,8 +941,8 @@ protected: void finishEdition(int oldKeyboardTop); void finishEditionToEmpty(); - gsl::not_null _history; - gsl::not_null _from; + not_null _history; + not_null _from; HistoryBlock *_block = nullptr; int _indexInBlock = -1; MTPDmessage::Flags _flags = 0; @@ -1045,7 +1045,7 @@ template class HistoryItemInstantiated { public: template - static gsl::not_null _create(Args &&... args) { + static not_null _create(Args &&... args) { auto result = new T(std::forward(args)...); result->finishCreate(); return result; diff --git a/Telegram/SourceFiles/history/history_media.h b/Telegram/SourceFiles/history/history_media.h index 20cffbef9e..c8580ebb3b 100644 --- a/Telegram/SourceFiles/history/history_media.h +++ b/Telegram/SourceFiles/history/history_media.h @@ -29,7 +29,7 @@ enum class MediaInBubbleState { class HistoryMedia : public HistoryElement { public: - HistoryMedia(gsl::not_null parent) : _parent(parent) { + HistoryMedia(not_null parent) : _parent(parent) { } virtual HistoryMediaType type() const = 0; @@ -225,7 +225,7 @@ protected: _parent->history()->eraseFromOverview(type, _parent->id); } - gsl::not_null _parent; + not_null _parent; int _width = 0; MediaInBubbleState _inBubbleState = MediaInBubbleState::None; diff --git a/Telegram/SourceFiles/history/history_media_types.cpp b/Telegram/SourceFiles/history/history_media_types.cpp index 1806d9ff96..145a5ff292 100644 --- a/Telegram/SourceFiles/history/history_media_types.cpp +++ b/Telegram/SourceFiles/history/history_media_types.cpp @@ -229,7 +229,7 @@ void HistoryFileMedia::checkAnimationFinished() const { HistoryFileMedia::~HistoryFileMedia() = default; -HistoryPhoto::HistoryPhoto(gsl::not_null parent, gsl::not_null photo, const QString &caption) : HistoryFileMedia(parent) +HistoryPhoto::HistoryPhoto(not_null parent, not_null photo, const QString &caption) : HistoryFileMedia(parent) , _data(photo) , _caption(st::minPhotoSize - st::msgPadding.left() - st::msgPadding.right()) { setLinks(MakeShared(_data), MakeShared(_data), MakeShared(_data)); @@ -239,7 +239,7 @@ HistoryPhoto::HistoryPhoto(gsl::not_null parent, gsl::not_null parent, gsl::not_null chat, gsl::not_null photo, int32 width) : HistoryFileMedia(parent) +HistoryPhoto::HistoryPhoto(not_null parent, not_null chat, not_null photo, int32 width) : HistoryFileMedia(parent) , _data(photo) { setLinks(MakeShared(_data, chat), MakeShared(_data, chat), MakeShared(_data, chat)); @@ -247,10 +247,10 @@ HistoryPhoto::HistoryPhoto(gsl::not_null parent, gsl::not_null parent, gsl::not_null chat, const MTPDphoto &photo, int32 width) : HistoryPhoto(parent, chat, App::feedPhoto(photo), width) { +HistoryPhoto::HistoryPhoto(not_null parent, not_null chat, const MTPDphoto &photo, int32 width) : HistoryPhoto(parent, chat, App::feedPhoto(photo), width) { } -HistoryPhoto::HistoryPhoto(gsl::not_null parent, const HistoryPhoto &other) : HistoryFileMedia(parent) +HistoryPhoto::HistoryPhoto(not_null parent, const HistoryPhoto &other) : HistoryFileMedia(parent) , _data(other._data) , _pixw(other._pixw) , _pixh(other._pixh) @@ -657,7 +657,7 @@ ImagePtr HistoryPhoto::replyPreview() { return _data->makeReplyPreview(); } -HistoryVideo::HistoryVideo(gsl::not_null parent, DocumentData *document, const QString &caption) : HistoryFileMedia(parent) +HistoryVideo::HistoryVideo(not_null parent, DocumentData *document, const QString &caption) : HistoryFileMedia(parent) , _data(document) , _thumbw(1) , _caption(st::minPhotoSize - st::msgPadding.left() - st::msgPadding.right()) { @@ -672,7 +672,7 @@ HistoryVideo::HistoryVideo(gsl::not_null parent, DocumentData *doc _data->thumb->load(); } -HistoryVideo::HistoryVideo(gsl::not_null parent, const HistoryVideo &other) : HistoryFileMedia(parent) +HistoryVideo::HistoryVideo(not_null parent, const HistoryVideo &other) : HistoryFileMedia(parent) , _data(other._data) , _thumbw(other._thumbw) , _caption(other._caption) { @@ -1048,7 +1048,7 @@ void HistoryDocumentVoice::stopSeeking() { Media::Player::instance()->stopSeeking(AudioMsgId::Type::Voice); } -HistoryDocument::HistoryDocument(gsl::not_null parent, DocumentData *document, const QString &caption) : HistoryFileMedia(parent) +HistoryDocument::HistoryDocument(not_null parent, DocumentData *document, const QString &caption) : HistoryFileMedia(parent) , _data(document) { createComponents(!caption.isEmpty()); if (auto named = Get()) { @@ -1064,7 +1064,7 @@ HistoryDocument::HistoryDocument(gsl::not_null parent, DocumentDat } } -HistoryDocument::HistoryDocument(gsl::not_null parent, const HistoryDocument &other) : HistoryFileMedia(parent) +HistoryDocument::HistoryDocument(not_null parent, const HistoryDocument &other) : HistoryFileMedia(parent) , RuntimeComposer() , _data(other._data) { auto captioned = other.Get(); @@ -1792,7 +1792,7 @@ ImagePtr HistoryDocument::replyPreview() { return _data->makeReplyPreview(); } -HistoryGif::HistoryGif(gsl::not_null parent, DocumentData *document, const QString &caption) : HistoryFileMedia(parent) +HistoryGif::HistoryGif(not_null parent, DocumentData *document, const QString &caption) : HistoryFileMedia(parent) , _data(document) , _caption(st::minPhotoSize - st::msgPadding.left() - st::msgPadding.right()) { setDocumentLinks(_data, true); @@ -1806,7 +1806,7 @@ HistoryGif::HistoryGif(gsl::not_null parent, DocumentData *documen _data->thumb->load(); } -HistoryGif::HistoryGif(gsl::not_null parent, const HistoryGif &other) : HistoryFileMedia(parent) +HistoryGif::HistoryGif(not_null parent, const HistoryGif &other) : HistoryFileMedia(parent) , _data(other._data) , _thumbw(other._thumbw) , _thumbh(other._thumbh) @@ -2627,7 +2627,7 @@ bool HistoryGif::dataLoaded() const { return (!_parent || _parent->id > 0) ? _data->loaded() : false; } -HistorySticker::HistorySticker(gsl::not_null parent, DocumentData *document) : HistoryMedia(parent) +HistorySticker::HistorySticker(not_null parent, DocumentData *document) : HistoryMedia(parent) , _data(document) , _emoji(_data->sticker()->alt) { _data->thumb->load(); @@ -2923,7 +2923,7 @@ ClickHandlerPtr addContactClickHandler(HistoryItem *item) { } // namespace -HistoryContact::HistoryContact(gsl::not_null parent, int32 userId, const QString &first, const QString &last, const QString &phone) : HistoryMedia(parent) +HistoryContact::HistoryContact(not_null parent, int32 userId, const QString &first, const QString &last, const QString &phone) : HistoryMedia(parent) , _userId(userId) , _fname(first) , _lname(last) @@ -3089,7 +3089,7 @@ void HistoryContact::updateSentMedia(const MTPMessageMedia &media) { } } -HistoryCall::HistoryCall(gsl::not_null parent, const MTPDmessageActionPhoneCall &call) : HistoryMedia(parent) +HistoryCall::HistoryCall(not_null parent, const MTPDmessageActionPhoneCall &call) : HistoryMedia(parent) , _reason(GetReason(call)) { if (_parent->out()) { _text = lang(_reason == FinishReason::Missed ? lng_call_cancelled : lng_call_outgoing); @@ -3238,13 +3238,13 @@ int unitedLineHeight() { } // namespace -HistoryWebPage::HistoryWebPage(gsl::not_null parent, gsl::not_null data) : HistoryMedia(parent) +HistoryWebPage::HistoryWebPage(not_null parent, not_null data) : HistoryMedia(parent) , _data(data) , _title(st::msgMinWidth - st::webPageLeft) , _description(st::msgMinWidth - st::webPageLeft) { } -HistoryWebPage::HistoryWebPage(gsl::not_null parent, const HistoryWebPage &other) : HistoryMedia(parent) +HistoryWebPage::HistoryWebPage(not_null parent, const HistoryWebPage &other) : HistoryMedia(parent) , _data(other._data) , _attach(other._attach ? other._attach->clone(parent) : nullptr) , _asArticle(other._asArticle) @@ -3784,13 +3784,13 @@ int HistoryWebPage::bottomInfoPadding() const { return result; } -HistoryGame::HistoryGame(gsl::not_null parent, GameData *data) : HistoryMedia(parent) +HistoryGame::HistoryGame(not_null parent, GameData *data) : HistoryMedia(parent) , _data(data) , _title(st::msgMinWidth - st::webPageLeft) , _description(st::msgMinWidth - st::webPageLeft) { } -HistoryGame::HistoryGame(gsl::not_null parent, const HistoryGame &other) : HistoryMedia(parent) +HistoryGame::HistoryGame(not_null parent, const HistoryGame &other) : HistoryMedia(parent) , _data(other._data) , _attach(other._attach ? other._attach->clone(parent) : nullptr) , _title(other._title) @@ -4176,14 +4176,14 @@ int HistoryGame::bottomInfoPadding() const { return result; } -HistoryInvoice::HistoryInvoice(gsl::not_null parent, const MTPDmessageMediaInvoice &data) : HistoryMedia(parent) +HistoryInvoice::HistoryInvoice(not_null parent, const MTPDmessageMediaInvoice &data) : HistoryMedia(parent) , _title(st::msgMinWidth) , _description(st::msgMinWidth) , _status(st::msgMinWidth) { fillFromData(data); } -HistoryInvoice::HistoryInvoice(gsl::not_null parent, const HistoryInvoice &other) : HistoryMedia(parent) +HistoryInvoice::HistoryInvoice(not_null parent, const HistoryInvoice &other) : HistoryMedia(parent) , _attach(other._attach ? other._attach->clone(parent) : nullptr) , _titleHeight(other._titleHeight) , _descriptionHeight(other._descriptionHeight) @@ -4558,7 +4558,7 @@ int HistoryInvoice::bottomInfoPadding() const { return result; } -HistoryLocation::HistoryLocation(gsl::not_null parent, const LocationCoords &coords, const QString &title, const QString &description) : HistoryMedia(parent) +HistoryLocation::HistoryLocation(not_null parent, const LocationCoords &coords, const QString &title, const QString &description) : HistoryMedia(parent) , _data(App::location(coords)) , _title(st::msgMinWidth) , _description(st::msgMinWidth) @@ -4574,7 +4574,7 @@ HistoryLocation::HistoryLocation(gsl::not_null parent, const Locat } } -HistoryLocation::HistoryLocation(gsl::not_null parent, const HistoryLocation &other) : HistoryMedia(parent) +HistoryLocation::HistoryLocation(not_null parent, const HistoryLocation &other) : HistoryMedia(parent) , _data(other._data) , _title(other._title) , _description(other._description) diff --git a/Telegram/SourceFiles/history/history_media_types.h b/Telegram/SourceFiles/history/history_media_types.h index 4888ed8073..5a77b7f42e 100644 --- a/Telegram/SourceFiles/history/history_media_types.h +++ b/Telegram/SourceFiles/history/history_media_types.h @@ -121,10 +121,10 @@ protected: class HistoryPhoto : public HistoryFileMedia { public: - HistoryPhoto(gsl::not_null parent, gsl::not_null photo, const QString &caption); - HistoryPhoto(gsl::not_null parent, gsl::not_null chat, gsl::not_null photo, int width); - HistoryPhoto(gsl::not_null parent, gsl::not_null chat, const MTPDphoto &photo, int width); - HistoryPhoto(gsl::not_null parent, const HistoryPhoto &other); + HistoryPhoto(not_null parent, not_null photo, const QString &caption); + HistoryPhoto(not_null parent, not_null chat, not_null photo, int width); + HistoryPhoto(not_null parent, not_null chat, const MTPDphoto &photo, int width); + HistoryPhoto(not_null parent, const HistoryPhoto &other); void init(); HistoryMediaType type() const override { @@ -201,7 +201,7 @@ protected: } private: - gsl::not_null _data; + not_null _data; int16 _pixw = 1; int16 _pixh = 1; Text _caption; @@ -210,8 +210,8 @@ private: class HistoryVideo : public HistoryFileMedia { public: - HistoryVideo(gsl::not_null parent, DocumentData *document, const QString &caption); - HistoryVideo(gsl::not_null parent, const HistoryVideo &other); + HistoryVideo(not_null parent, DocumentData *document, const QString &caption); + HistoryVideo(not_null parent, const HistoryVideo &other); HistoryMediaType type() const override { return MediaTypeVideo; } @@ -287,7 +287,7 @@ protected: } private: - gsl::not_null _data; + not_null _data; int32 _thumbw; Text _caption; @@ -360,8 +360,8 @@ private: class HistoryDocument : public HistoryFileMedia, public RuntimeComposer { public: - HistoryDocument(gsl::not_null parent, DocumentData *document, const QString &caption); - HistoryDocument(gsl::not_null parent, const HistoryDocument &other); + HistoryDocument(not_null parent, DocumentData *document, const QString &caption); + HistoryDocument(not_null parent, const HistoryDocument &other); HistoryMediaType type() const override { return _data->voice() ? MediaTypeVoiceFile : (_data->song() ? MediaTypeMusicFile : MediaTypeFile); } @@ -467,14 +467,14 @@ private: template void buildStringRepresentation(Callback callback) const; - gsl::not_null _data; + not_null _data; }; class HistoryGif : public HistoryFileMedia { public: - HistoryGif(gsl::not_null parent, DocumentData *document, const QString &caption); - HistoryGif(gsl::not_null parent, const HistoryGif &other); + HistoryGif(not_null parent, DocumentData *document, const QString &caption); + HistoryGif(not_null parent, const HistoryGif &other); HistoryMediaType type() const override { return MediaTypeGif; } @@ -570,7 +570,7 @@ private: QString mediaTypeString() const; bool isSeparateRoundVideo() const; - gsl::not_null _data; + not_null _data; ClickHandlerPtr _openInMediaviewLink; int32 _thumbw = 1; int32 _thumbh = 1; @@ -586,7 +586,7 @@ private: class HistorySticker : public HistoryMedia { public: - HistorySticker(gsl::not_null parent, DocumentData *document); + HistorySticker(not_null parent, DocumentData *document); HistoryMediaType type() const override { return MediaTypeSticker; } @@ -648,14 +648,14 @@ private: int16 _pixw = 1; int16 _pixh = 1; ClickHandlerPtr _packLink; - gsl::not_null _data; + not_null _data; QString _emoji; }; class HistoryContact : public HistoryMedia { public: - HistoryContact(gsl::not_null parent, int32 userId, const QString &first, const QString &last, const QString &phone); + HistoryContact(not_null parent, int32 userId, const QString &first, const QString &last, const QString &phone); HistoryMediaType type() const override { return MediaTypeContact; } @@ -717,7 +717,7 @@ private: class HistoryCall : public HistoryMedia { public: - HistoryCall(gsl::not_null parent, const MTPDmessageActionPhoneCall &call); + HistoryCall(not_null parent, const MTPDmessageActionPhoneCall &call); HistoryMediaType type() const override { return MediaTypeCall; } @@ -772,8 +772,8 @@ private: class HistoryWebPage : public HistoryMedia { public: - HistoryWebPage(gsl::not_null parent, gsl::not_null data); - HistoryWebPage(gsl::not_null parent, const HistoryWebPage &other); + HistoryWebPage(not_null parent, not_null data); + HistoryWebPage(not_null parent, const HistoryWebPage &other); HistoryMediaType type() const override { return MediaTypeWebPage; } @@ -829,7 +829,7 @@ public: bool hasReplyPreview() const override; ImagePtr replyPreview() override; - gsl::not_null webpage() { + not_null webpage() { return _data; } @@ -858,7 +858,7 @@ private: int bottomInfoPadding() const; bool isLogEntryOriginal() const; - gsl::not_null _data; + not_null _data; ClickHandlerPtr _openl; std::unique_ptr _attach; @@ -878,8 +878,8 @@ private: class HistoryGame : public HistoryMedia { public: - HistoryGame(gsl::not_null parent, GameData *data); - HistoryGame(gsl::not_null parent, const HistoryGame &other); + HistoryGame(not_null parent, GameData *data); + HistoryGame(not_null parent, const HistoryGame &other); HistoryMediaType type() const override { return MediaTypeGame; } @@ -985,8 +985,8 @@ private: class HistoryInvoice : public HistoryMedia { public: - HistoryInvoice(gsl::not_null parent, const MTPDmessageMediaInvoice &data); - HistoryInvoice(gsl::not_null parent, const HistoryInvoice &other); + HistoryInvoice(not_null parent, const MTPDmessageMediaInvoice &data); + HistoryInvoice(not_null parent, const HistoryInvoice &other); HistoryMediaType type() const override { return MediaTypeInvoice; } @@ -1079,8 +1079,8 @@ struct LocationData; class HistoryLocation : public HistoryMedia { public: - HistoryLocation(gsl::not_null parent, const LocationCoords &coords, const QString &title = QString(), const QString &description = QString()); - HistoryLocation(gsl::not_null parent, const HistoryLocation &other); + HistoryLocation(not_null parent, const LocationCoords &coords, const QString &title = QString(), const QString &description = QString()); + HistoryLocation(not_null parent, const HistoryLocation &other); HistoryMediaType type() const override { return MediaTypeLocation; } diff --git a/Telegram/SourceFiles/history/history_message.cpp b/Telegram/SourceFiles/history/history_message.cpp index 73732c17dc..b8196d30a8 100644 --- a/Telegram/SourceFiles/history/history_message.cpp +++ b/Telegram/SourceFiles/history/history_message.cpp @@ -78,7 +78,7 @@ style::color fromNameFgSelected(int index) { return colors[index]; } -MTPDmessage::Flags NewForwardedFlags(gsl::not_null peer, UserId from, gsl::not_null fwd) { +MTPDmessage::Flags NewForwardedFlags(not_null peer, UserId from, not_null fwd) { auto result = NewMessageFlags(peer) | MTPDmessage::Flag::f_fwd_from; if (from) { result |= MTPDmessage::Flag::f_from_id; @@ -170,7 +170,7 @@ bool HasInlineItems(const SelectedItemSet &items) { } // namespace -void FastShareMessage(gsl::not_null item) { +void FastShareMessage(not_null item) { struct ShareData { ShareData(const FullMsgId &msgId) : msgId(msgId) { } @@ -291,7 +291,7 @@ base::lambda HistoryDependentItemCallback(const FullM }; } -MTPDmessage::Flags NewMessageFlags(gsl::not_null peer) { +MTPDmessage::Flags NewMessageFlags(not_null peer) { MTPDmessage::Flags result = 0; if (!peer->isSelf()) { result |= MTPDmessage::Flag::f_out; @@ -302,7 +302,7 @@ MTPDmessage::Flags NewMessageFlags(gsl::not_null peer) { return result; } -QString GetErrorTextForForward(gsl::not_null peer, const SelectedItemSet &items) { +QString GetErrorTextForForward(not_null peer, const SelectedItemSet &items) { if (!peer->canWrite()) { return lang(lng_forward_cant); } @@ -551,7 +551,7 @@ const style::TextStyle &HistoryMessage::KeyboardStyle::textStyle() const { return st::serviceTextStyle; } -void HistoryMessage::KeyboardStyle::repaint(gsl::not_null item) const { +void HistoryMessage::KeyboardStyle::repaint(not_null item) const { Ui::repaintHistoryItem(item); } @@ -605,7 +605,7 @@ int HistoryMessage::KeyboardStyle::minButtonWidth(HistoryMessageReplyMarkup::But return result; } -HistoryMessage::HistoryMessage(gsl::not_null history, const MTPDmessage &msg) +HistoryMessage::HistoryMessage(not_null history, const MTPDmessage &msg) : HistoryItem(history, msg.vid.v, msg.vflags.v, ::date(msg.vdate), msg.has_from_id() ? msg.vfrom_id.v : 0) { CreateConfig config; @@ -634,7 +634,7 @@ HistoryMessage::HistoryMessage(gsl::not_null history, const MTPDmessag setText({ text, entities }); } -HistoryMessage::HistoryMessage(gsl::not_null history, const MTPDmessageService &msg) +HistoryMessage::HistoryMessage(not_null 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) { CreateConfig config; @@ -653,7 +653,7 @@ HistoryMessage::HistoryMessage(gsl::not_null history, const MTPDmessag setText(TextWithEntities {}); } -HistoryMessage::HistoryMessage(gsl::not_null history, MsgId id, MTPDmessage::Flags flags, QDateTime date, UserId from, const QString &postAuthor, gsl::not_null fwd) +HistoryMessage::HistoryMessage(not_null history, MsgId id, MTPDmessage::Flags flags, QDateTime date, UserId from, const QString &postAuthor, not_null fwd) : HistoryItem(history, id, NewForwardedFlags(history->peer, from, fwd) | flags, date, from) { CreateConfig config; @@ -704,14 +704,14 @@ HistoryMessage::HistoryMessage(gsl::not_null history, MsgId id, MTPDme setText(fwd->originalText()); } -HistoryMessage::HistoryMessage(gsl::not_null 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, 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) { createComponentsHelper(flags, replyTo, viaBotId, postAuthor, MTPnullMarkup); setText(textWithEntities); } -HistoryMessage::HistoryMessage(gsl::not_null 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, 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) { createComponentsHelper(flags, replyTo, viaBotId, postAuthor, markup); @@ -719,7 +719,7 @@ HistoryMessage::HistoryMessage(gsl::not_null history, MsgId msgId, MTP setText(TextWithEntities()); } -HistoryMessage::HistoryMessage(gsl::not_null 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, 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) { createComponentsHelper(flags, replyTo, viaBotId, postAuthor, markup); @@ -727,7 +727,7 @@ HistoryMessage::HistoryMessage(gsl::not_null history, MsgId msgId, MTP setText(TextWithEntities()); } -HistoryMessage::HistoryMessage(gsl::not_null 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, 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) { createComponentsHelper(flags, replyTo, viaBotId, postAuthor, markup); diff --git a/Telegram/SourceFiles/history/history_message.h b/Telegram/SourceFiles/history/history_message.h index 9bbd2adac2..0ef8c76b45 100644 --- a/Telegram/SourceFiles/history/history_message.h +++ b/Telegram/SourceFiles/history/history_message.h @@ -22,31 +22,31 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org void HistoryInitMessages(); base::lambda HistoryDependentItemCallback(const FullMsgId &msgId); -MTPDmessage::Flags NewMessageFlags(gsl::not_null peer); -QString GetErrorTextForForward(gsl::not_null peer, const SelectedItemSet &items); -void FastShareMessage(gsl::not_null item); +MTPDmessage::Flags NewMessageFlags(not_null peer); +QString GetErrorTextForForward(not_null peer, const SelectedItemSet &items); +void FastShareMessage(not_null item); class HistoryMessage : public HistoryItem, private HistoryItemInstantiated { public: - static gsl::not_null create(gsl::not_null history, const MTPDmessage &msg) { + static not_null create(not_null history, const MTPDmessage &msg) { return _create(history, msg); } - static gsl::not_null create(gsl::not_null history, const MTPDmessageService &msg) { + static not_null create(not_null history, const MTPDmessageService &msg) { return _create(history, msg); } - static gsl::not_null create(gsl::not_null history, MsgId msgId, MTPDmessage::Flags flags, QDateTime date, UserId from, const QString &postAuthor, gsl::not_null fwd) { + static not_null create(not_null history, MsgId msgId, MTPDmessage::Flags flags, QDateTime date, UserId from, const QString &postAuthor, not_null fwd) { return _create(history, msgId, flags, date, from, postAuthor, fwd); } - static gsl::not_null create(gsl::not_null history, MsgId msgId, MTPDmessage::Flags flags, MsgId replyTo, UserId viaBotId, QDateTime date, UserId from, const QString &postAuthor, const TextWithEntities &textWithEntities) { + static not_null create(not_null 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); } - static gsl::not_null create(gsl::not_null 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 create(not_null 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); } - static gsl::not_null create(gsl::not_null 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 create(not_null 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); } - static gsl::not_null create(gsl::not_null 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 create(not_null 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); } @@ -146,13 +146,13 @@ public: ~HistoryMessage(); private: - HistoryMessage(gsl::not_null history, const MTPDmessage &msg); - HistoryMessage(gsl::not_null history, const MTPDmessageService &msg); - HistoryMessage(gsl::not_null history, MsgId msgId, MTPDmessage::Flags flags, QDateTime date, UserId from, const QString &postAuthor, gsl::not_null fwd); // local forwarded - HistoryMessage(gsl::not_null 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, 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, 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, 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, const MTPDmessage &msg); + HistoryMessage(not_null history, const MTPDmessageService &msg); + HistoryMessage(not_null history, MsgId msgId, MTPDmessage::Flags flags, QDateTime date, UserId from, const QString &postAuthor, not_null fwd); // local forwarded + HistoryMessage(not_null 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, 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, 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, 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; void setEmptyText(); @@ -218,7 +218,7 @@ private: void startPaint(Painter &p) const override; const style::TextStyle &textStyle() const override; - void repaint(gsl::not_null item) const override; + void repaint(not_null item) const override; protected: void paintButtonBg(Painter &p, const QRect &rect, float64 howMuchOver) const override; diff --git a/Telegram/SourceFiles/history/history_service.cpp b/Telegram/SourceFiles/history/history_service.cpp index 2adba8cfc9..ef35648d2b 100644 --- a/Telegram/SourceFiles/history/history_service.cpp +++ b/Telegram/SourceFiles/history/history_service.cpp @@ -400,17 +400,17 @@ HistoryService::PreparedText HistoryService::preparePaymentSentText() { return result; } -HistoryService::HistoryService(gsl::not_null history, const MTPDmessage &message) : +HistoryService::HistoryService(not_null history, const MTPDmessage &message) : HistoryItem(history, message.vid.v, message.vflags.v, ::date(message.vdate), message.has_from_id() ? message.vfrom_id.v : 0) { createFromMtp(message); } -HistoryService::HistoryService(gsl::not_null history, const MTPDmessageService &message) : +HistoryService::HistoryService(not_null 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) { createFromMtp(message); } -HistoryService::HistoryService(gsl::not_null history, MsgId msgId, QDateTime date, const PreparedText &message, MTPDmessage::Flags flags, int32 from, PhotoData *photo) : +HistoryService::HistoryService(not_null history, MsgId msgId, QDateTime date, const PreparedText &message, MTPDmessage::Flags flags, int32 from, PhotoData *photo) : HistoryItem(history, msgId, flags, date, from) { setServiceText(message); if (photo) { @@ -772,11 +772,11 @@ HistoryService::~HistoryService() { _media.reset(); } -HistoryJoined::HistoryJoined(gsl::not_null history, const QDateTime &inviteDate, gsl::not_null inviter, MTPDmessage::Flags flags) +HistoryJoined::HistoryJoined(not_null history, const QDateTime &inviteDate, not_null inviter, MTPDmessage::Flags flags) : HistoryService(history, clientMsgId(), inviteDate, GenerateText(history, inviter), flags) { } -HistoryJoined::PreparedText HistoryJoined::GenerateText(gsl::not_null history, gsl::not_null inviter) { +HistoryJoined::PreparedText HistoryJoined::GenerateText(not_null history, not_null inviter) { if (inviter->id == Auth().userPeerId()) { return { lang(history->isMegagroup() ? lng_action_you_joined_group : lng_action_you_joined) }; } diff --git a/Telegram/SourceFiles/history/history_service.h b/Telegram/SourceFiles/history/history_service.h index 500080f7fd..d95007ab77 100644 --- a/Telegram/SourceFiles/history/history_service.h +++ b/Telegram/SourceFiles/history/history_service.h @@ -58,13 +58,13 @@ public: QList links; }; - static gsl::not_null create(gsl::not_null history, const MTPDmessage &message) { + static not_null create(not_null history, const MTPDmessage &message) { return _create(history, message); } - static gsl::not_null create(gsl::not_null history, const MTPDmessageService &message) { + static not_null create(not_null history, const MTPDmessageService &message) { return _create(history, message); } - static gsl::not_null create(gsl::not_null history, MsgId msgId, QDateTime date, const PreparedText &message, MTPDmessage::Flags flags = 0, UserId from = 0, PhotoData *photo = nullptr) { + static not_null create(not_null 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); } @@ -116,9 +116,9 @@ public: protected: friend class HistoryLayout::ServiceMessagePainter; - HistoryService(gsl::not_null history, const MTPDmessage &message); - HistoryService(gsl::not_null history, const MTPDmessageService &message); - HistoryService(gsl::not_null history, MsgId msgId, QDateTime date, const PreparedText &message, MTPDmessage::Flags flags = 0, UserId from = 0, PhotoData *photo = 0); + HistoryService(not_null history, const MTPDmessage &message); + HistoryService(not_null history, const MTPDmessageService &message); + HistoryService(not_null history, MsgId msgId, QDateTime date, const PreparedText &message, MTPDmessage::Flags flags = 0, UserId from = 0, PhotoData *photo = 0); friend class HistoryItemInstantiated; void initDimensions() override; @@ -168,17 +168,17 @@ private: class HistoryJoined : public HistoryService, private HistoryItemInstantiated { public: - static gsl::not_null create(gsl::not_null history, const QDateTime &inviteDate, gsl::not_null inviter, MTPDmessage::Flags flags) { + static not_null create(not_null history, const QDateTime &inviteDate, not_null inviter, MTPDmessage::Flags flags) { return _create(history, inviteDate, inviter, flags); } protected: - HistoryJoined(gsl::not_null history, const QDateTime &inviteDate, gsl::not_null inviter, MTPDmessage::Flags flags); + HistoryJoined(not_null history, const QDateTime &inviteDate, not_null inviter, MTPDmessage::Flags flags); using HistoryItemInstantiated::_create; friend class HistoryItemInstantiated; private: - static PreparedText GenerateText(gsl::not_null history, gsl::not_null inviter); + static PreparedText GenerateText(not_null history, not_null inviter); }; diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index f2efbdf37f..fea788a9e3 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -607,7 +607,7 @@ QPoint SilentToggle::tooltipPos() const { return QCursor::pos(); } -HistoryWidget::HistoryWidget(QWidget *parent, gsl::not_null controller) : Window::AbstractSectionWidget(parent, controller) +HistoryWidget::HistoryWidget(QWidget *parent, not_null controller) : Window::AbstractSectionWidget(parent, controller) , _fieldBarCancel(this, st::historyReplyCancel) , _topBar(this, controller) , _scroll(this, st::historyScroll, false) @@ -955,7 +955,7 @@ void HistoryWidget::highlightMessage(HistoryItem *context) { } } -int HistoryWidget::itemTopForHighlight(gsl::not_null item) const { +int HistoryWidget::itemTopForHighlight(not_null item) const { auto itemTop = _list->itemTop(item); 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 msg, int row, int col) { +void HistoryWidget::app_sendBotCallback(const HistoryMessageReplyMarkup::Button *button, not_null msg, int row, int col) { if (msg->id < 0 || _peer != msg->history()->peer) { return; } @@ -4642,7 +4642,7 @@ void HistoryWidget::grabFinish() { _topShadow->show(); } -void HistoryWidget::ui_repaintHistoryItem(gsl::not_null item) { +void HistoryWidget::ui_repaintHistoryItem(not_null item) { if (_peer && _list && (item->history() == _history || (_migrated && item->history() == _migrated))) { auto ms = getms(); if (_lastScrolled + kSkipRepaintWhileScrollMs <= ms) { diff --git a/Telegram/SourceFiles/history/history_widget.h b/Telegram/SourceFiles/history/history_widget.h index 8d2c3df4ac..8664ae88ba 100644 --- a/Telegram/SourceFiles/history/history_widget.h +++ b/Telegram/SourceFiles/history/history_widget.h @@ -170,7 +170,7 @@ class HistoryWidget final : public Window::AbstractSectionWidget, public RPCSend Q_OBJECT public: - HistoryWidget(QWidget *parent, gsl::not_null controller); + HistoryWidget(QWidget *parent, not_null controller); void start(); @@ -349,9 +349,9 @@ public: bool wheelEventFromFloatPlayer(QEvent *e, 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 msg, int row, int col); + void app_sendBotCallback(const HistoryMessageReplyMarkup::Button *button, not_null msg, int row, int col); - void ui_repaintHistoryItem(gsl::not_null item); + void ui_repaintHistoryItem(not_null item); PeerData *ui_getPeerForMouseAction(); void notify_historyItemLayoutChanged(const HistoryItem *item); @@ -662,7 +662,7 @@ private: // Counts scrollTop for placing the scroll right at the unread // messages bar, choosing from _history and _migrated unreadBar. int unreadBarTop() const; - int itemTopForHighlight(gsl::not_null item) const; + int itemTopForHighlight(not_null item) const; void scrollToCurrentVoiceMessage(FullMsgId fromId, FullMsgId toId); // Scroll to current y without updating the _lastUserScrolled time. diff --git a/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp b/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp index 97eccc7b3b..7158b2e25b 100644 --- a/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp +++ b/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.cpp @@ -37,10 +37,10 @@ namespace InlineBots { namespace Layout { namespace internal { -FileBase::FileBase(gsl::not_null context, Result *result) : ItemBase(context, result) { +FileBase::FileBase(not_null context, Result *result) : ItemBase(context, result) { } -FileBase::FileBase(gsl::not_null context, DocumentData *document) : ItemBase(context, document) { +FileBase::FileBase(not_null context, DocumentData *document) : ItemBase(context, document) { } DocumentData *FileBase::getShownDocument() const { @@ -94,10 +94,10 @@ ImagePtr FileBase::content_thumb() const { return getResultThumb(); } -Gif::Gif(gsl::not_null context, Result *result) : FileBase(context, result) { +Gif::Gif(not_null context, Result *result) : FileBase(context, result) { } -Gif::Gif(gsl::not_null context, DocumentData *document, bool hasDeleteButton) : FileBase(context, document) { +Gif::Gif(not_null context, DocumentData *document, bool hasDeleteButton) : FileBase(context, document) { if (hasDeleteButton) { _delete = MakeShared(document); } @@ -358,7 +358,7 @@ void Gif::clipCallback(Media::Clip::Notification notification) { } } -Sticker::Sticker(gsl::not_null context, Result *result) : FileBase(context, result) { +Sticker::Sticker(not_null context, Result *result) : FileBase(context, result) { } void Sticker::initDimensions() { @@ -458,7 +458,7 @@ void Sticker::prepareThumb() const { } } -Photo::Photo(gsl::not_null context, Result *result) : ItemBase(context, result) { +Photo::Photo(not_null context, Result *result) : ItemBase(context, result) { } void Photo::initDimensions() { @@ -554,7 +554,7 @@ void Photo::prepareThumb(int32 width, int32 height, const QSize &frame) const { } } -Video::Video(gsl::not_null context, Result *result) : FileBase(context, result) +Video::Video(not_null context, Result *result) : FileBase(context, result) , _link(getResultContentUrlHandler()) , _title(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(); } -File::File(gsl::not_null context, Result *result) : FileBase(context, result) +File::File(not_null context, Result *result) : FileBase(context, result) , _title(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(result)) @@ -881,7 +881,7 @@ void File::setStatusSize(int32 newSize, int32 fullSize, int32 duration, qint64 r } } -Contact::Contact(gsl::not_null context, Result *result) : ItemBase(context, result) +Contact::Contact(not_null context, Result *result) : ItemBase(context, result) , _title(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, Result *result, bool withThumb) : ItemBase(context, result) +Article::Article(not_null context, Result *result, bool withThumb) : ItemBase(context, result) , _url(getResultUrlHandler()) , _link(getResultContentUrlHandler()) , _withThumb(withThumb) @@ -1117,7 +1117,7 @@ void Article::prepareThumb(int width, int height) const { } } -Game::Game(gsl::not_null context, Result *result) : ItemBase(context, result) +Game::Game(not_null context, Result *result) : ItemBase(context, result) , _title(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::inlineThumbSize - st::inlineThumbSkip) , _description(st::emojiPanWidth - st::emojiScroll.width - st::inlineResultsLeft - st::inlineThumbSize - st::inlineThumbSkip) { countFrameSize(); diff --git a/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.h b/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.h index a6ecb85876..464a66d5e4 100644 --- a/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.h +++ b/Telegram/SourceFiles/inline_bots/inline_bot_layout_internal.h @@ -30,9 +30,9 @@ namespace internal { class FileBase : public ItemBase { public: - FileBase(gsl::not_null context, Result *result); + FileBase(not_null context, Result *result); // for saved gif layouts - FileBase(gsl::not_null context, DocumentData *doc); + FileBase(not_null context, DocumentData *doc); protected: DocumentData *getShownDocument() const; @@ -58,8 +58,8 @@ private: class Gif : public FileBase { public: - Gif(gsl::not_null context, Result *result); - Gif(gsl::not_null context, DocumentData *doc, bool hasDeleteButton); + Gif(not_null context, Result *result); + Gif(not_null context, DocumentData *doc, bool hasDeleteButton); void setPosition(int32 position) override; void initDimensions() override; @@ -117,9 +117,9 @@ private: class Photo : public ItemBase { public: - Photo(gsl::not_null context, Result *result); + Photo(not_null context, Result *result); // Not used anywhere currently. - //Photo(gsl::not_null context, PhotoData *photo); + //Photo(not_null context, PhotoData *photo); void initDimensions() override; @@ -146,9 +146,9 @@ private: class Sticker : public FileBase { public: - Sticker(gsl::not_null context, Result *result); + Sticker(not_null context, Result *result); // Not used anywhere currently. - //Sticker(gsl::not_null context, DocumentData *document); + //Sticker(not_null context, DocumentData *document); void initDimensions() override; @@ -180,7 +180,7 @@ private: class Video : public FileBase { public: - Video(gsl::not_null context, Result *result); + Video(not_null context, Result *result); void initDimensions() override; @@ -227,7 +227,7 @@ private: class File : public FileBase { public: - File(gsl::not_null context, Result *result); + File(not_null context, Result *result); void initDimensions() override; @@ -289,7 +289,7 @@ private: class Contact : public ItemBase { public: - Contact(gsl::not_null context, Result *result); + Contact(not_null context, Result *result); void initDimensions() override; int resizeGetHeight(int width) override; @@ -307,7 +307,7 @@ private: class Article : public ItemBase { public: - Article(gsl::not_null context, Result *result, bool withThumb); + Article(not_null context, Result *result, bool withThumb); void initDimensions() override; int resizeGetHeight(int width) override; @@ -330,7 +330,7 @@ private: class Game : public ItemBase { public: - Game(gsl::not_null context, Result *result); + Game(not_null context, Result *result); void setPosition(int32 position) override; void initDimensions() override; diff --git a/Telegram/SourceFiles/inline_bots/inline_bot_layout_item.cpp b/Telegram/SourceFiles/inline_bots/inline_bot_layout_item.cpp index 9fa6d1ee10..3ae0e1da37 100644 --- a/Telegram/SourceFiles/inline_bots/inline_bot_layout_item.cpp +++ b/Telegram/SourceFiles/inline_bots/inline_bot_layout_item.cpp @@ -105,7 +105,7 @@ void ItemBase::layoutChanged() { } } -std::unique_ptr ItemBase::createLayout(gsl::not_null context, Result *result, bool forceThumb) { +std::unique_ptr ItemBase::createLayout(not_null context, Result *result, bool forceThumb) { using Type = Result::Type; switch (result->_type) { @@ -124,7 +124,7 @@ std::unique_ptr ItemBase::createLayout(gsl::not_null context return nullptr; } -std::unique_ptr ItemBase::createLayoutGif(gsl::not_null context, DocumentData *document) { +std::unique_ptr ItemBase::createLayoutGif(not_null context, DocumentData *document) { return std::make_unique(context, document, true); } diff --git a/Telegram/SourceFiles/inline_bots/inline_bot_layout_item.h b/Telegram/SourceFiles/inline_bots/inline_bot_layout_item.h index 5dbf0705ff..f817b458a0 100644 --- a/Telegram/SourceFiles/inline_bots/inline_bot_layout_item.h +++ b/Telegram/SourceFiles/inline_bots/inline_bot_layout_item.h @@ -56,12 +56,12 @@ public: class ItemBase : public LayoutItemBase { public: - ItemBase(gsl::not_null context, Result *result) : _result(result), _context(context) { + ItemBase(not_null context, Result *result) : _result(result), _context(context) { } - ItemBase(gsl::not_null context, DocumentData *doc) : _doc(doc), _context(context) { + ItemBase(not_null context, DocumentData *doc) : _doc(doc), _context(context) { } // Not used anywhere currently. - //ItemBase(gsl::not_null context, PhotoData *photo) : _photo(photo), _context(context) { + //ItemBase(not_null context, PhotoData *photo) : _photo(photo), _context(context) { //} virtual void paint(Painter &p, const QRect &clip, const PaintContext *context) const = 0; @@ -98,8 +98,8 @@ public: update(); } - static std::unique_ptr createLayout(gsl::not_null context, Result *result, bool forceThumb); - static std::unique_ptr createLayoutGif(gsl::not_null context, DocumentData *document); + static std::unique_ptr createLayout(not_null context, Result *result, bool forceThumb); + static std::unique_ptr createLayoutGif(not_null context, DocumentData *document); protected: DocumentData *getResultDocument() const; @@ -112,7 +112,7 @@ protected: ClickHandlerPtr getResultContentUrlHandler() const; QString getResultThumbLetter() const; - gsl::not_null context() const { + not_null context() const { return _context; } @@ -125,7 +125,7 @@ protected: int _position = 0; // < 0 means removed from layout private: - gsl::not_null _context; + not_null _context; }; diff --git a/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp b/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp index 54ad943105..e1435b737c 100644 --- a/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp +++ b/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp @@ -48,7 +48,7 @@ constexpr auto kInlineBotRequestDelay = 400; } // namespace -Inner::Inner(QWidget *parent, gsl::not_null controller) : TWidget(parent) +Inner::Inner(QWidget *parent, not_null controller) : TWidget(parent) , _controller(controller) { resize(st::emojiPanWidth - st::emojiScroll.width - st::buttonRadius, st::emojiPanMinHeight); @@ -711,7 +711,7 @@ void Inner::onSwitchPm() { } // namespace internal -Widget::Widget(QWidget *parent, gsl::not_null controller) : TWidget(parent) +Widget::Widget(QWidget *parent, not_null controller) : TWidget(parent) , _controller(controller) , _contentMaxHeight(st::emojiPanMaxHeight) , _contentHeight(_contentMaxHeight) diff --git a/Telegram/SourceFiles/inline_bots/inline_results_widget.h b/Telegram/SourceFiles/inline_bots/inline_results_widget.h index 09d55173ce..6316c88366 100644 --- a/Telegram/SourceFiles/inline_bots/inline_results_widget.h +++ b/Telegram/SourceFiles/inline_bots/inline_results_widget.h @@ -63,7 +63,7 @@ class Inner : public TWidget, public Context, private base::Subscriber { Q_OBJECT public: - Inner(QWidget *parent, gsl::not_null controller); + Inner(QWidget *parent, not_null controller); void hideFinish(bool completely); @@ -118,7 +118,7 @@ private: void refreshSwitchPmButton(const CacheEntry *entry); - gsl::not_null _controller; + not_null _controller; int _visibleTop = 0; int _visibleBottom = 0; @@ -170,7 +170,7 @@ class Widget : public TWidget, private MTP::Sender { Q_OBJECT public: - Widget(QWidget *parent, gsl::not_null controller); + Widget(QWidget *parent, not_null controller); void moveBottom(int bottom); @@ -240,7 +240,7 @@ private: bool refreshInlineRows(int *added = nullptr); void inlineResultsDone(const MTPmessages_BotResults &result); - gsl::not_null _controller; + not_null _controller; int _contentMaxHeight = 0; int _contentHeight = 0; diff --git a/Telegram/SourceFiles/lang/lang_cloud_manager.cpp b/Telegram/SourceFiles/lang/lang_cloud_manager.cpp index 5f7bfae0a1..5e1b3605dd 100644 --- a/Telegram/SourceFiles/lang/lang_cloud_manager.cpp +++ b/Telegram/SourceFiles/lang/lang_cloud_manager.cpp @@ -32,7 +32,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org namespace Lang { -CloudManager::CloudManager(Instance &langpack, gsl::not_null mtproto) : MTP::Sender() +CloudManager::CloudManager(Instance &langpack, not_null mtproto) : MTP::Sender() , _langpack(langpack) { requestLangPackDifference(); } diff --git a/Telegram/SourceFiles/lang/lang_cloud_manager.h b/Telegram/SourceFiles/lang/lang_cloud_manager.h index 9140581fed..d272502e7d 100644 --- a/Telegram/SourceFiles/lang/lang_cloud_manager.h +++ b/Telegram/SourceFiles/lang/lang_cloud_manager.h @@ -33,7 +33,7 @@ class Instance; class CloudManager : public base::enable_weak_from_this, private MTP::Sender, private base::Subscriber { public: - CloudManager(Instance &langpack, gsl::not_null mtproto); + CloudManager(Instance &langpack, not_null mtproto); struct Language { QString id; diff --git a/Telegram/SourceFiles/layerwidget.cpp b/Telegram/SourceFiles/layerwidget.cpp index 71a9ce779d..e4df03910f 100644 --- a/Telegram/SourceFiles/layerwidget.cpp +++ b/Telegram/SourceFiles/layerwidget.cpp @@ -730,7 +730,7 @@ LayerStackWidget::~LayerStackWidget() { if (App::wnd()) App::wnd()->noLayerStack(this); } -MediaPreviewWidget::MediaPreviewWidget(QWidget *parent, gsl::not_null controller) : TWidget(parent) +MediaPreviewWidget::MediaPreviewWidget(QWidget *parent, not_null controller) : TWidget(parent) , _controller(controller) , _emojiSize(Ui::Emoji::Size(Ui::Emoji::Index() + 1) / cIntRetinaFactor()) { setAttribute(Qt::WA_TransparentForMouseEvents); diff --git a/Telegram/SourceFiles/layerwidget.h b/Telegram/SourceFiles/layerwidget.h index 3cf4a17f76..a516bdc4d8 100644 --- a/Telegram/SourceFiles/layerwidget.h +++ b/Telegram/SourceFiles/layerwidget.h @@ -169,7 +169,7 @@ class MediaPreviewWidget : public TWidget, private base::Subscriber { Q_OBJECT public: - MediaPreviewWidget(QWidget *parent, gsl::not_null controller); + MediaPreviewWidget(QWidget *parent, not_null controller); void showPreview(DocumentData *document); void showPreview(PhotoData *photo); @@ -188,7 +188,7 @@ private: void fillEmojiString(); void resetGifAndCache(); - gsl::not_null _controller; + not_null _controller; Animation _a_shown; bool _hiding = false; @@ -197,7 +197,7 @@ private: Media::Clip::ReaderPointer _gif; int _emojiSize; - std::vector> _emojiList; + std::vector> _emojiList; void clipCallback(Media::Clip::Notification notification); diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 0d65916200..59b046b94e 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -115,7 +115,7 @@ MainWidget::Float::Float(QWidget *parent, HistoryItem *item, ToggleCallback togg }) { } -MainWidget::MainWidget(QWidget *parent, gsl::not_null controller) : TWidget(parent) +MainWidget::MainWidget(QWidget *parent, not_null controller) : TWidget(parent) , _controller(controller) , _dialogsWidth(st::dialogsWidthMin) , _sideShadow(this, st::shadowFg) @@ -251,10 +251,10 @@ void MainWidget::checkCurrentFloatPlayer() { if (auto media = item->getMedia()) { if (auto document = media->getDocument()) { if (document->isRoundVideo()) { - _playerFloats.push_back(std::make_unique(this, item, [this](gsl::not_null instance, bool visible) { + _playerFloats.push_back(std::make_unique(this, item, [this](not_null instance, bool visible) { instance->hiddenByWidget = !visible; toggleFloatPlayer(instance); - }, [this](gsl::not_null instance, bool closed) { + }, [this](not_null instance, bool closed) { finishFloatPlayerDrag(instance, closed); })); currentFloatPlayer()->column = Auth().data().floatPlayerColumn(); @@ -267,7 +267,7 @@ void MainWidget::checkCurrentFloatPlayer() { } } -void MainWidget::toggleFloatPlayer(gsl::not_null instance) { +void MainWidget::toggleFloatPlayer(not_null instance) { auto visible = !instance->hiddenByHistory && !instance->hiddenByWidget && instance->widget->isReady(); if (instance->visible != visible) { instance->widget->resetMouseState(); @@ -298,7 +298,7 @@ void MainWidget::checkFloatPlayerVisibility() { updateFloatPlayerPosition(instance); } -void MainWidget::updateFloatPlayerPosition(gsl::not_null instance) { +void MainWidget::updateFloatPlayerPosition(not_null instance) { auto visible = instance->visibleAnimation.current(instance->visible ? 1. : 0.); if (visible == 0. && !instance->visible) { instance->widget->hide(); @@ -347,7 +347,7 @@ QPoint MainWidget::getFloatPlayerHiddenPosition(QPoint position, QSize size, Rec Unexpected("Bad side in MainWidget::getFloatPlayerHiddenPosition()."); } -QPoint MainWidget::getFloatPlayerPosition(gsl::not_null instance) const { +QPoint MainWidget::getFloatPlayerPosition(not_null instance) const { auto column = instance->column; auto section = getFloatPlayerSection(&column); auto rect = section->rectForFloatPlayer(column, instance->column); @@ -376,7 +376,7 @@ RectPart MainWidget::getFloatPlayerSide(QPoint center) const { return RectPart::Bottom; } -void MainWidget::removeFloatPlayer(gsl::not_null instance) { +void MainWidget::removeFloatPlayer(not_null instance) { auto widget = std::move(instance->widget); auto i = std::find_if(_playerFloats.begin(), _playerFloats.end(), [instance](auto &item) { return (item.get() == instance); @@ -391,7 +391,7 @@ void MainWidget::removeFloatPlayer(gsl::not_null instance) { widget.destroy(); } -Window::AbstractSectionWidget *MainWidget::getFloatPlayerSection(gsl::not_null column) const { +Window::AbstractSectionWidget *MainWidget::getFloatPlayerSection(not_null column) const { if (!Adaptive::Normal()) { *column = Adaptive::OneColumn() ? Window::Column::First : Window::Column::Second; if (Adaptive::OneColumn() && selectingPeer()) { @@ -476,7 +476,7 @@ void MainWidget::updateFloatPlayerColumnCorner(QPoint center) { } } -void MainWidget::finishFloatPlayerDrag(gsl::not_null instance, bool closed) { +void MainWidget::finishFloatPlayerDrag(not_null instance, bool closed) { instance->dragFrom = instance->widget->pos(); auto center = instance->widget->geometry().center(); if (closed) { @@ -795,7 +795,7 @@ void MainWidget::notify_migrateUpdated(PeerData *peer) { _history->notify_migrateUpdated(peer); } -void MainWidget::ui_repaintHistoryItem(gsl::not_null item) { +void MainWidget::ui_repaintHistoryItem(not_null item) { if (item->isLogEntry()) { Auth().data().repaintLogEntry().notify(item, true); } 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)); } -void MainWidget::addParticipants(PeerData *chatOrChannel, const std::vector> &users) { +void MainWidget::addParticipants(PeerData *chatOrChannel, const std::vector> &users) { if (chatOrChannel->isChat()) { auto chat = chatOrChannel->asChat(); for_const (auto user, users) { @@ -1970,7 +1970,7 @@ void MainWidget::inlineResultLoadFailed(FileLoader *loader, bool started) { //Ui::repaintInlineItem(); } -void MainWidget::mediaMarkRead(gsl::not_null data) { +void MainWidget::mediaMarkRead(not_null data) { auto &items = App::documentItems(); auto i = items.constFind(data); if (i != items.cend()) { @@ -2002,7 +2002,7 @@ void MainWidget::mediaMarkRead(const HistoryItemsMap &items) { } } -void MainWidget::mediaMarkRead(gsl::not_null item) { +void MainWidget::mediaMarkRead(not_null item) { if ((!item->out() || item->mentionsMe()) && item->isMediaUnread()) { item->markMediaRead(); if (item->id > 0) { diff --git a/Telegram/SourceFiles/mainwidget.h b/Telegram/SourceFiles/mainwidget.h index f1be08d99f..4c56f61967 100644 --- a/Telegram/SourceFiles/mainwidget.h +++ b/Telegram/SourceFiles/mainwidget.h @@ -153,7 +153,7 @@ class MainWidget : public TWidget, public RPCSender, private base::Subscriber { Q_OBJECT public: - MainWidget(QWidget *parent, gsl::not_null controller); + MainWidget(QWidget *parent, not_null controller); bool isSectionShown() const; @@ -271,7 +271,7 @@ public: void clearHistory(PeerData *peer); void deleteAllFromUser(ChannelData *channel, UserData *from); - void addParticipants(PeerData *chatOrChannel, const std::vector> &users); + void addParticipants(PeerData *chatOrChannel, const std::vector> &users); struct UserAndPeer { UserData *user; PeerData *peer; @@ -316,7 +316,7 @@ public: void hideSingleUseKeyboard(PeerData *peer, MsgId replyTo); bool insertBotCommand(const QString &cmd); - void jumpToDate(gsl::not_null peer, const QDate &date); + void jumpToDate(not_null peer, const QDate &date); void searchMessages(const QString &query, PeerData *inPeer); bool preloadOverview(PeerData *peer, MediaOverviewType type); void itemEdited(HistoryItem *item); @@ -348,9 +348,9 @@ public: void cancelForwarding(History *history); void finishForwarding(History *history, bool silent); // send them - void mediaMarkRead(gsl::not_null data); + void mediaMarkRead(not_null data); void mediaMarkRead(const HistoryItemsMap &items); - void mediaMarkRead(gsl::not_null item); + void mediaMarkRead(not_null item); void webPageUpdated(WebPageData *page); void gameUpdated(GameData *game); @@ -385,7 +385,7 @@ public: void app_sendBotCallback(const HistoryMessageReplyMarkup::Button *button, const HistoryItem *msg, int row, int col); - void ui_repaintHistoryItem(gsl::not_null item); + void ui_repaintHistoryItem(not_null item); void ui_showPeerHistory(quint64 peer, qint32 msgId, Ui::ShowWay way); PeerData *ui_getPeerForMouseAction(); @@ -569,17 +569,17 @@ private: void clearCachedBackground(); void checkCurrentFloatPlayer(); - void toggleFloatPlayer(gsl::not_null instance); + void toggleFloatPlayer(not_null instance); void checkFloatPlayerVisibility(); - void updateFloatPlayerPosition(gsl::not_null instance); - void removeFloatPlayer(gsl::not_null instance); + void updateFloatPlayerPosition(not_null instance); + void removeFloatPlayer(not_null instance); Float *currentFloatPlayer() const { return _playerFloats.empty() ? nullptr : _playerFloats.back().get(); } - Window::AbstractSectionWidget *getFloatPlayerSection(gsl::not_null column) const; - void finishFloatPlayerDrag(gsl::not_null instance, bool closed); + Window::AbstractSectionWidget *getFloatPlayerSection(not_null column) const; + void finishFloatPlayerDrag(not_null instance, bool closed); void updateFloatPlayerColumnCorner(QPoint center); - QPoint getFloatPlayerPosition(gsl::not_null instance) const; + QPoint getFloatPlayerPosition(not_null instance) const; QPoint getFloatPlayerHiddenPosition(QPoint position, QSize size, RectPart side) const; RectPart getFloatPlayerSide(QPoint center) const; @@ -591,7 +591,7 @@ private: void viewsIncrementDone(QVector ids, const MTPVector &result, mtpRequestId req); bool viewsIncrementFail(const RPCError &error, mtpRequestId req); - gsl::not_null _controller; + not_null _controller; bool _started = false; OrderedSet _webPagesUpdated; diff --git a/Telegram/SourceFiles/media/media_audio_track.cpp b/Telegram/SourceFiles/media/media_audio_track.cpp index 092d074092..51efe4a773 100644 --- a/Telegram/SourceFiles/media/media_audio_track.cpp +++ b/Telegram/SourceFiles/media/media_audio_track.cpp @@ -54,7 +54,7 @@ ALuint CreateBuffer() { } // namespace -Track::Track(gsl::not_null instance) : _instance(instance) { +Track::Track(not_null instance) : _instance(instance) { _instance->registerTrack(this); } diff --git a/Telegram/SourceFiles/media/media_audio_track.h b/Telegram/SourceFiles/media/media_audio_track.h index 84f2339a92..b14a12c407 100644 --- a/Telegram/SourceFiles/media/media_audio_track.h +++ b/Telegram/SourceFiles/media/media_audio_track.h @@ -29,7 +29,7 @@ class Instance; class Track { public: - Track(gsl::not_null instance); + Track(not_null instance); void samplePeakEach(TimeMs peakDuration); @@ -70,7 +70,7 @@ private: void ensureSourceCreated(); void playWithLooping(bool looping); - gsl::not_null _instance; + not_null _instance; bool _failed = false; bool _active = false; diff --git a/Telegram/SourceFiles/media/media_clip_reader.cpp b/Telegram/SourceFiles/media/media_clip_reader.cpp index 2f6ae3b2cb..960aece0dd 100644 --- a/Telegram/SourceFiles/media/media_clip_reader.cpp +++ b/Telegram/SourceFiles/media/media_clip_reader.cpp @@ -100,7 +100,7 @@ Reader::Reader(const QString &filepath, Callback &&callback, Mode mode, int64 se init(FileLocation(filepath), QByteArray()); } -Reader::Reader(gsl::not_null document, FullMsgId msgId, Callback &&callback, Mode mode, int64 seekMs) +Reader::Reader(not_null document, FullMsgId msgId, Callback &&callback, Mode mode, int64 seekMs) : _callback(std::move(callback)) , _mode(mode) , _audioMsgId(document, msgId, (mode == Mode::Video) ? rand_value() : 0) diff --git a/Telegram/SourceFiles/media/media_clip_reader.h b/Telegram/SourceFiles/media/media_clip_reader.h index 260d36532e..dae972eae6 100644 --- a/Telegram/SourceFiles/media/media_clip_reader.h +++ b/Telegram/SourceFiles/media/media_clip_reader.h @@ -62,7 +62,7 @@ public: }; Reader(const QString &filepath, Callback &&callback, Mode mode = Mode::Gif, TimeMs seekMs = 0); - Reader(gsl::not_null document, FullMsgId msgId, Callback &&callback, Mode mode = Mode::Gif, TimeMs seekMs = 0); + Reader(not_null 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 diff --git a/Telegram/SourceFiles/media/player/media_player_float.h b/Telegram/SourceFiles/media/player/media_player_float.h index 6b47b99147..d175e36ca9 100644 --- a/Telegram/SourceFiles/media/player/media_player_float.h +++ b/Telegram/SourceFiles/media/player/media_player_float.h @@ -59,7 +59,7 @@ public: finishDrag(false); } } - void ui_repaintHistoryItem(gsl::not_null item) { + void ui_repaintHistoryItem(not_null item) { if (item == _item) { repaintItem(); } diff --git a/Telegram/SourceFiles/media/player/media_player_list.cpp b/Telegram/SourceFiles/media/player/media_player_list.cpp index a4e915d387..fcc9e61556 100644 --- a/Telegram/SourceFiles/media/player/media_player_list.cpp +++ b/Telegram/SourceFiles/media/player/media_player_list.cpp @@ -118,7 +118,7 @@ void ListWidget::mouseMoveEvent(QMouseEvent *e) { } } -void ListWidget::ui_repaintHistoryItem(gsl::not_null item) { +void ListWidget::ui_repaintHistoryItem(not_null item) { repaintItem(item); } diff --git a/Telegram/SourceFiles/media/player/media_player_list.h b/Telegram/SourceFiles/media/player/media_player_list.h index 1f7193b8d1..b2a6973c53 100644 --- a/Telegram/SourceFiles/media/player/media_player_list.h +++ b/Telegram/SourceFiles/media/player/media_player_list.h @@ -33,7 +33,7 @@ class ListWidget : public TWidget, private base::Subscriber { public: ListWidget(QWidget *parent); - void ui_repaintHistoryItem(gsl::not_null item); + void ui_repaintHistoryItem(not_null item); QRect getCurrentTrackGeometry() const; diff --git a/Telegram/SourceFiles/media/player/media_player_panel.cpp b/Telegram/SourceFiles/media/player/media_player_panel.cpp index a166294fb0..179ed04d7f 100644 --- a/Telegram/SourceFiles/media/player/media_player_panel.cpp +++ b/Telegram/SourceFiles/media/player/media_player_panel.cpp @@ -96,7 +96,7 @@ void Panel::updateControlsGeometry() { } } -void Panel::ui_repaintHistoryItem(gsl::not_null item) { +void Panel::ui_repaintHistoryItem(not_null item) { if (auto list = static_cast(_scroll->widget())) { list->ui_repaintHistoryItem(item); } diff --git a/Telegram/SourceFiles/media/player/media_player_panel.h b/Telegram/SourceFiles/media/player/media_player_panel.h index 902aa9f754..20c3234cdf 100644 --- a/Telegram/SourceFiles/media/player/media_player_panel.h +++ b/Telegram/SourceFiles/media/player/media_player_panel.h @@ -52,7 +52,7 @@ public: void setPinCallback(ButtonCallback &&callback); void setCloseCallback(ButtonCallback &&callback); - void ui_repaintHistoryItem(gsl::not_null item); + void ui_repaintHistoryItem(not_null item); int bestPositionFor(int left) const; diff --git a/Telegram/SourceFiles/mediaview.cpp b/Telegram/SourceFiles/mediaview.cpp index 967ce90bbe..60ba3d41d4 100644 --- a/Telegram/SourceFiles/mediaview.cpp +++ b/Telegram/SourceFiles/mediaview.cpp @@ -2957,7 +2957,7 @@ float64 MediaView::overLevel(OverState control) const { return (i == _animOpacities.cend()) ? (_over == control ? 1 : 0) : i->current(); } -MsgId MediaView::getMsgIdFromOverview(gsl::not_null history, int index) const { +MsgId MediaView::getMsgIdFromOverview(not_null history, int index) const { auto &overview = history->overview(_overview); if (index >= 0 && index < overview.size()) { auto it = overview.begin(); diff --git a/Telegram/SourceFiles/mediaview.h b/Telegram/SourceFiles/mediaview.h index a200c88db1..b75eac532d 100644 --- a/Telegram/SourceFiles/mediaview.h +++ b/Telegram/SourceFiles/mediaview.h @@ -224,7 +224,7 @@ private: bool updateOverState(OverState newState); float64 overLevel(OverState control) const; - MsgId getMsgIdFromOverview(gsl::not_null history, int index) const; + MsgId getMsgIdFromOverview(not_null history, int index) const; QBrush _transparentBrush; diff --git a/Telegram/SourceFiles/messenger.cpp b/Telegram/SourceFiles/messenger.cpp index f176526507..e32ad2bbd3 100644 --- a/Telegram/SourceFiles/messenger.cpp +++ b/Telegram/SourceFiles/messenger.cpp @@ -195,27 +195,27 @@ bool Messenger::hideMediaView() { return false; } -void Messenger::showPhoto(gsl::not_null link, HistoryItem *item) { +void Messenger::showPhoto(not_null link, HistoryItem *item) { return (!item && link->peer()) ? showPhoto(link->photo(), link->peer()) : showPhoto(link->photo(), item); } -void Messenger::showPhoto(gsl::not_null photo, HistoryItem *item) { +void Messenger::showPhoto(not_null photo, HistoryItem *item) { if (_mediaView->isHidden()) Ui::hideLayer(true); _mediaView->showPhoto(photo, item); _mediaView->activateWindow(); _mediaView->setFocus(); } -void Messenger::showPhoto(gsl::not_null photo, PeerData *peer) { +void Messenger::showPhoto(not_null photo, PeerData *peer) { if (_mediaView->isHidden()) Ui::hideLayer(true); _mediaView->showPhoto(photo, peer); _mediaView->activateWindow(); _mediaView->setFocus(); } -void Messenger::showDocument(gsl::not_null document, HistoryItem *item) { +void Messenger::showDocument(not_null document, HistoryItem *item) { if (cUseExternalVideoPlayer() && document->isVideo()) { QDesktopServices::openUrl(QUrl("file:///" + document->location(false).fname)); } else { diff --git a/Telegram/SourceFiles/messenger.h b/Telegram/SourceFiles/messenger.h index 779bc85e2b..be21734257 100644 --- a/Telegram/SourceFiles/messenger.h +++ b/Telegram/SourceFiles/messenger.h @@ -82,10 +82,10 @@ public: // MediaView interface. void checkMediaViewActivation(); bool hideMediaView(); - void showPhoto(gsl::not_null link, HistoryItem *item = nullptr); - void showPhoto(gsl::not_null photo, HistoryItem *item); - void showPhoto(gsl::not_null photo, PeerData *item); - void showDocument(gsl::not_null document, HistoryItem *item); + void showPhoto(not_null link, HistoryItem *item = nullptr); + void showPhoto(not_null photo, HistoryItem *item); + void showPhoto(not_null photo, PeerData *item); + void showDocument(not_null document, HistoryItem *item); PeerData *ui_getPeerForMouseAction(); QPoint getPointForCallPanelCenter() const; diff --git a/Telegram/SourceFiles/mtproto/config_loader.cpp b/Telegram/SourceFiles/mtproto/config_loader.cpp index c507f038c5..525e060d2a 100644 --- a/Telegram/SourceFiles/mtproto/config_loader.cpp +++ b/Telegram/SourceFiles/mtproto/config_loader.cpp @@ -33,7 +33,7 @@ constexpr auto kSpecialRequestTimeoutMs = 6000; // 4 seconds timeout for it to w } // namespace -ConfigLoader::ConfigLoader(gsl::not_null instance, RPCDoneHandlerPtr onDone, RPCFailHandlerPtr onFail) : _instance(instance) +ConfigLoader::ConfigLoader(not_null instance, RPCDoneHandlerPtr onDone, RPCFailHandlerPtr onFail) : _instance(instance) , _doneHandler(onDone) , _failHandler(onFail) { _enumDCTimer.setCallback([this] { enumerate(); }); diff --git a/Telegram/SourceFiles/mtproto/config_loader.h b/Telegram/SourceFiles/mtproto/config_loader.h index 6df54a954c..9d4c708558 100644 --- a/Telegram/SourceFiles/mtproto/config_loader.h +++ b/Telegram/SourceFiles/mtproto/config_loader.h @@ -33,7 +33,7 @@ namespace internal { class ConfigLoader : public base::enable_weak_from_this { public: - ConfigLoader(gsl::not_null instance, RPCDoneHandlerPtr onDone, RPCFailHandlerPtr onFail); + ConfigLoader(not_null instance, RPCDoneHandlerPtr onDone, RPCFailHandlerPtr onFail); ~ConfigLoader(); void load(); @@ -49,7 +49,7 @@ private: void terminateRequest(); void terminateSpecialRequest(); - gsl::not_null _instance; + not_null _instance; base::Timer _enumDCTimer; DcId _enumCurrent = 0; mtpRequestId _enumRequest = 0; diff --git a/Telegram/SourceFiles/mtproto/dc_options.cpp b/Telegram/SourceFiles/mtproto/dc_options.cpp index bf293cfff3..61f37159f0 100644 --- a/Telegram/SourceFiles/mtproto/dc_options.cpp +++ b/Telegram/SourceFiles/mtproto/dc_options.cpp @@ -33,7 +33,7 @@ public: } private: - gsl::not_null _that; + not_null _that; QWriteLocker _lock; }; diff --git a/Telegram/SourceFiles/mtproto/dcenter.cpp b/Telegram/SourceFiles/mtproto/dcenter.cpp index b4750f6dfb..754ccc5de3 100644 --- a/Telegram/SourceFiles/mtproto/dcenter.cpp +++ b/Telegram/SourceFiles/mtproto/dcenter.cpp @@ -36,7 +36,7 @@ constexpr auto kSpecialRequestTimeoutMs = 6000; // 4 seconds timeout for it to w } // namespace -Dcenter::Dcenter(gsl::not_null instance, DcId dcId, AuthKeyPtr &&key) +Dcenter::Dcenter(not_null instance, DcId dcId, AuthKeyPtr &&key) : _instance(instance) , _id(dcId) , _key(std::move(key)) { diff --git a/Telegram/SourceFiles/mtproto/dcenter.h b/Telegram/SourceFiles/mtproto/dcenter.h index 59a2aa87e1..fa01645f70 100644 --- a/Telegram/SourceFiles/mtproto/dcenter.h +++ b/Telegram/SourceFiles/mtproto/dcenter.h @@ -32,7 +32,7 @@ class Dcenter : public QObject { Q_OBJECT public: - Dcenter(gsl::not_null instance, DcId dcId, AuthKeyPtr &&key); + Dcenter(not_null instance, DcId dcId, AuthKeyPtr &&key); QReadWriteLock *keyMutex() const; const AuthKeyPtr &getKey() const; @@ -59,7 +59,7 @@ private slots: private: mutable QReadWriteLock keyLock; mutable QMutex initLock; - gsl::not_null _instance; + not_null _instance; DcId _id = 0; AuthKeyPtr _key; bool _connectionInited = false; diff --git a/Telegram/SourceFiles/mtproto/mtp_instance.cpp b/Telegram/SourceFiles/mtproto/mtp_instance.cpp index e71241e571..f6906199b2 100644 --- a/Telegram/SourceFiles/mtproto/mtp_instance.cpp +++ b/Telegram/SourceFiles/mtproto/mtp_instance.cpp @@ -38,7 +38,7 @@ namespace MTP { class Instance::Private : private Sender { public: - Private(gsl::not_null instance, gsl::not_null options, Instance::Mode mode); + Private(not_null instance, not_null options, Instance::Mode mode); void start(Config &&config); @@ -50,7 +50,7 @@ public: AuthKeysList getKeysForWrite() const; void addKeysForDestroy(AuthKeysList &&keys); - gsl::not_null dcOptions(); + not_null dcOptions(); void requestConfig(); void requestCDNConfig(); @@ -137,8 +137,8 @@ private: void checkDelayedRequests(); - gsl::not_null _instance; - gsl::not_null _dcOptions; + not_null _instance; + not_null _dcOptions; Instance::Mode _mode = Instance::Mode::Normal; DcId _mainDcId = Config::kDefaultMainDc; @@ -194,7 +194,7 @@ private: }; -Instance::Private::Private(gsl::not_null instance, gsl::not_null options, Instance::Mode mode) : Sender() +Instance::Private::Private(not_null instance, not_null options, Instance::Mode mode) : Sender() , _instance(instance) , _dcOptions(options) , _mode(mode) { @@ -556,7 +556,7 @@ void Instance::Private::addKeysForDestroy(AuthKeysList &&keys) { } } -gsl::not_null Instance::Private::dcOptions() { +not_null Instance::Private::dcOptions() { return _dcOptions; } @@ -1272,7 +1272,7 @@ void Instance::Private::prepareToDestroy() { MustNotCreateSessions = true; } -Instance::Instance(gsl::not_null options, Mode mode, Config &&config) : QObject() +Instance::Instance(not_null options, Mode mode, Config &&config) : QObject() , _private(std::make_unique(this, options, mode)) { _private->start(std::move(config)); } @@ -1369,7 +1369,7 @@ void Instance::addKeysForDestroy(AuthKeysList &&keys) { _private->addKeysForDestroy(std::move(keys)); } -gsl::not_null Instance::dcOptions() { +not_null Instance::dcOptions() { return _private->dcOptions(); } diff --git a/Telegram/SourceFiles/mtproto/mtp_instance.h b/Telegram/SourceFiles/mtproto/mtp_instance.h index ef76313fc3..32d65d1153 100644 --- a/Telegram/SourceFiles/mtproto/mtp_instance.h +++ b/Telegram/SourceFiles/mtproto/mtp_instance.h @@ -52,7 +52,7 @@ public: SpecialConfigRequester, KeysDestroyer, }; - Instance(gsl::not_null options, Mode mode, Config &&config); + Instance(not_null options, Mode mode, Config &&config); Instance(const Instance &other) = delete; Instance &operator=(const Instance &other) = delete; @@ -67,7 +67,7 @@ public: AuthKeysList getKeysForWrite() const; void addKeysForDestroy(AuthKeysList &&keys); - gsl::not_null dcOptions(); + not_null dcOptions(); template mtpRequestId send(const TRequest &request, RPCResponseHandler callbacks = RPCResponseHandler(), ShiftedDcId dcId = 0, TimeMs msCanWait = 0, mtpRequestId after = 0) { diff --git a/Telegram/SourceFiles/mtproto/sender.h b/Telegram/SourceFiles/mtproto/sender.h index 42b3ca57ca..11db35d9e7 100644 --- a/Telegram/SourceFiles/mtproto/sender.h +++ b/Telegram/SourceFiles/mtproto/sender.h @@ -64,7 +64,7 @@ class Sender { using Callback = typename Policy::Callback; public: - DoneHandler(gsl::not_null sender, Callback handler) : _sender(sender), _handler(std::move(handler)) { + DoneHandler(not_null sender, Callback handler) : _sender(sender), _handler(std::move(handler)) { } void operator()(mtpRequestId requestId, const mtpPrime *from, const mtpPrime *end) override { @@ -79,7 +79,7 @@ class Sender { } private: - gsl::not_null _sender; + not_null _sender; Callback _handler; }; @@ -103,7 +103,7 @@ class Sender { using Callback = typename Policy::Callback; public: - FailHandler(gsl::not_null sender, Callback handler, FailSkipPolicy skipPolicy) + FailHandler(not_null sender, Callback handler, FailSkipPolicy skipPolicy) : _sender(sender) , _handler(std::move(handler)) , _skipPolicy(skipPolicy) { @@ -130,13 +130,13 @@ class Sender { } private: - gsl::not_null _sender; + not_null _sender; Callback _handler; FailSkipPolicy _skipPolicy = FailSkipPolicy::Simple; }; - explicit RequestBuilder(gsl::not_null sender) noexcept : _sender(sender) { + explicit RequestBuilder(not_null sender) noexcept : _sender(sender) { } RequestBuilder(RequestBuilder &&other) = default; @@ -183,7 +183,7 @@ class Sender { return _afterRequestId; } - gsl::not_null sender() const noexcept { + not_null sender() const noexcept { return _sender; } void registerRequest(mtpRequestId requestId) { @@ -191,7 +191,7 @@ class Sender { } private: - gsl::not_null _sender; + not_null _sender; ShiftedDcId _dcId = 0; TimeMs _canWait = 0; RPCDoneHandlerPtr _done; @@ -209,7 +209,7 @@ public: class SpecificRequestBuilder : public RequestBuilder { private: friend class Sender; - SpecificRequestBuilder(gsl::not_null sender, Request &&request) noexcept : RequestBuilder(sender), _request(std::move(request)) { + SpecificRequestBuilder(not_null sender, Request &&request) noexcept : RequestBuilder(sender), _request(std::move(request)) { } SpecificRequestBuilder(SpecificRequestBuilder &&other) = default; @@ -265,7 +265,7 @@ public: class SentRequestWrap { private: friend class Sender; - SentRequestWrap(gsl::not_null sender, mtpRequestId requestId) : _sender(sender), _requestId(requestId) { + SentRequestWrap(not_null sender, mtpRequestId requestId) : _sender(sender), _requestId(requestId) { } public: @@ -274,7 +274,7 @@ public: } private: - gsl::not_null _sender; + not_null _sender; mtpRequestId _requestId = 0; }; @@ -298,7 +298,7 @@ public: request.handled(); } } - gsl::not_null requestMTP() const { + not_null requestMTP() const { return MainInstance(); } diff --git a/Telegram/SourceFiles/mtproto/session.cpp b/Telegram/SourceFiles/mtproto/session.cpp index f93a5bac52..56d5d14980 100644 --- a/Telegram/SourceFiles/mtproto/session.cpp +++ b/Telegram/SourceFiles/mtproto/session.cpp @@ -86,7 +86,7 @@ void SessionData::clear(Instance *instance) { instance->clearCallbacksDelayed(clearCallbacks); } -Session::Session(gsl::not_null instance, ShiftedDcId shiftedDcId) : QObject() +Session::Session(not_null instance, ShiftedDcId shiftedDcId) : QObject() , _instance(instance) , data(this) , dcWithShift(shiftedDcId) { diff --git a/Telegram/SourceFiles/mtproto/session.h b/Telegram/SourceFiles/mtproto/session.h index 2ff8c675f7..54559d0e56 100644 --- a/Telegram/SourceFiles/mtproto/session.h +++ b/Telegram/SourceFiles/mtproto/session.h @@ -101,7 +101,7 @@ inline bool ResponseNeedsAck(const SerializedMessage &response) { class Session; class SessionData { public: - SessionData(gsl::not_null creator) : _owner(creator) { + SessionData(not_null creator) : _owner(creator) { } void setSession(uint64 session) { @@ -166,27 +166,27 @@ public: _keyChecked = checked; } - gsl::not_null keyMutex() const; + not_null keyMutex() const; - gsl::not_null toSendMutex() const { + not_null toSendMutex() const { return &_toSendLock; } - gsl::not_null haveSentMutex() const { + not_null haveSentMutex() const { return &_haveSentLock; } - gsl::not_null toResendMutex() const { + not_null toResendMutex() const { return &_toResendLock; } - gsl::not_null wereAckedMutex() const { + not_null wereAckedMutex() const { return &_wereAckedLock; } - gsl::not_null receivedIdsMutex() const { + not_null receivedIdsMutex() const { return &_receivedIdsLock; } - gsl::not_null haveReceivedMutex() const { + not_null haveReceivedMutex() const { return &_haveReceivedLock; } - gsl::not_null stateRequestMutex() const { + not_null stateRequestMutex() const { return &_stateRequestLock; } @@ -239,10 +239,10 @@ public: return _stateRequest; } - gsl::not_null owner() { + not_null owner() { return _owner; } - gsl::not_null owner() const { + not_null owner() const { return _owner; } @@ -261,7 +261,7 @@ private: uint32 _messagesSent = 0; - gsl::not_null _owner; + not_null _owner; AuthKeyPtr _authKey; bool _keyChecked = false; @@ -295,7 +295,7 @@ class Session : public QObject { Q_OBJECT public: - Session(gsl::not_null instance, ShiftedDcId shiftedDcId); + Session(not_null instance, ShiftedDcId shiftedDcId); void start(); void restart(); @@ -357,7 +357,7 @@ private: mtpRequest getRequest(mtpRequestId requestId); bool rpcErrorOccured(mtpRequestId requestId, const RPCFailHandlerPtr &onFail, const RPCError &err); - gsl::not_null _instance; + not_null _instance; std::unique_ptr _connection; bool _killed = false; @@ -378,7 +378,7 @@ private: }; -inline gsl::not_null SessionData::keyMutex() const { +inline not_null SessionData::keyMutex() const { return _owner->keyMutex(); } diff --git a/Telegram/SourceFiles/overviewwidget.cpp b/Telegram/SourceFiles/overviewwidget.cpp index abfd97a3cb..34c22e544e 100644 --- a/Telegram/SourceFiles/overviewwidget.cpp +++ b/Telegram/SourceFiles/overviewwidget.cpp @@ -1950,7 +1950,7 @@ OverviewInner::~OverviewInner() { clear(); } -OverviewWidget::OverviewWidget(QWidget *parent, gsl::not_null controller, PeerData *peer, MediaOverviewType type) : Window::AbstractSectionWidget(parent, controller) +OverviewWidget::OverviewWidget(QWidget *parent, not_null controller, PeerData *peer, MediaOverviewType type) : Window::AbstractSectionWidget(parent, controller) , _topBar(this, controller) , _scroll(this, st::settingsScroll, false) , _mediaType(this, st::defaultDropdownMenu) @@ -2290,7 +2290,7 @@ void OverviewWidget::grabFinish() { _topShadow->show(); } -void OverviewWidget::ui_repaintHistoryItem(gsl::not_null item) { +void OverviewWidget::ui_repaintHistoryItem(not_null item) { if (peer() == item->history()->peer || migratePeer() == item->history()->peer) { _inner->repaintItem(item); } diff --git a/Telegram/SourceFiles/overviewwidget.h b/Telegram/SourceFiles/overviewwidget.h index 7334d75140..bc0ad184bc 100644 --- a/Telegram/SourceFiles/overviewwidget.h +++ b/Telegram/SourceFiles/overviewwidget.h @@ -289,7 +289,7 @@ class OverviewWidget : public Window::AbstractSectionWidget, public RPCSender { Q_OBJECT public: - OverviewWidget(QWidget *parent, gsl::not_null controller, PeerData *peer, MediaOverviewType type); + OverviewWidget(QWidget *parent, not_null controller, PeerData *peer, MediaOverviewType type); void clear(); @@ -351,7 +351,7 @@ public: bool wheelEventFromFloatPlayer(QEvent *e, Window::Column myColumn, Window::Column playerColumn) override; QRect rectForFloatPlayer(Window::Column myColumn, Window::Column playerColumn) override; - void ui_repaintHistoryItem(gsl::not_null item); + void ui_repaintHistoryItem(not_null item); void notify_historyItemLayoutChanged(const HistoryItem *item); diff --git a/Telegram/SourceFiles/platform/mac/main_window_mac.mm b/Telegram/SourceFiles/platform/mac/main_window_mac.mm index 144b3467cb..b433bcb641 100644 --- a/Telegram/SourceFiles/platform/mac/main_window_mac.mm +++ b/Telegram/SourceFiles/platform/mac/main_window_mac.mm @@ -437,7 +437,7 @@ void MainWindow::createGlobalMenu() { if (App::wnd() && App::wnd()->isHidden()) App::wnd()->showFromTray(); if (!App::self()) return; - Ui::show(Box(std::make_unique(), [](gsl::not_null box) { + Ui::show(Box(std::make_unique(), [](not_null box) { box->addButton(langFactory(lng_close), [box] { box->closeBox(); }); box->addLeftButton(langFactory(lng_profile_add_contact), [] { App::wnd()->onShowAddContact(); }); })); diff --git a/Telegram/SourceFiles/profile/profile_block_group_members.cpp b/Telegram/SourceFiles/profile/profile_block_group_members.cpp index 742c29b758..87a65c6a8c 100644 --- a/Telegram/SourceFiles/profile/profile_block_group_members.cpp +++ b/Telegram/SourceFiles/profile/profile_block_group_members.cpp @@ -67,7 +67,7 @@ GroupMembersWidget::GroupMembersWidget(QWidget *parent, PeerData *peer, TitleVis refreshMembers(); } -void GroupMembersWidget::editAdmin(gsl::not_null user) { +void GroupMembersWidget::editAdmin(not_null user) { auto megagroup = peer()->asMegagroup(); if (!megagroup) { return; // not supported @@ -87,7 +87,7 @@ void GroupMembersWidget::editAdmin(gsl::not_null user) { Ui::show(std::move(box)); } -void GroupMembersWidget::restrictUser(gsl::not_null user) { +void GroupMembersWidget::restrictUser(not_null user) { auto megagroup = peer()->asMegagroup(); if (!megagroup) { return; // not supported diff --git a/Telegram/SourceFiles/profile/profile_block_group_members.h b/Telegram/SourceFiles/profile/profile_block_group_members.h index c1b993cc60..4710bd460f 100644 --- a/Telegram/SourceFiles/profile/profile_block_group_members.h +++ b/Telegram/SourceFiles/profile/profile_block_group_members.h @@ -67,8 +67,8 @@ private: // Observed notifications. void notifyPeerUpdated(const Notify::PeerUpdate &update); - void editAdmin(gsl::not_null user); - void restrictUser(gsl::not_null user); + void editAdmin(not_null user); + void restrictUser(not_null user); void removePeer(PeerData *selectedPeer); void refreshMembers(); void fillChatMembers(ChatData *chat); diff --git a/Telegram/SourceFiles/profile/profile_block_widget.h b/Telegram/SourceFiles/profile/profile_block_widget.h index 0e73317f9b..2ed5a74085 100644 --- a/Telegram/SourceFiles/profile/profile_block_widget.h +++ b/Telegram/SourceFiles/profile/profile_block_widget.h @@ -35,9 +35,9 @@ public: virtual void showFinished() { } - virtual void saveState(gsl::not_null memento) { + virtual void saveState(not_null memento) { } - virtual void restoreState(gsl::not_null memento) { + virtual void restoreState(not_null memento) { } protected: diff --git a/Telegram/SourceFiles/profile/profile_channel_controllers.cpp b/Telegram/SourceFiles/profile/profile_channel_controllers.cpp index aa6991896b..12d766aed6 100644 --- a/Telegram/SourceFiles/profile/profile_channel_controllers.cpp +++ b/Telegram/SourceFiles/profile/profile_channel_controllers.cpp @@ -38,7 +38,7 @@ constexpr auto kParticipantsPerPage = 200; } // namespace -ParticipantsBoxController::ParticipantsBoxController(gsl::not_null channel, Role role) : PeerListController(CreateSearchController(channel, role, &_additional)) +ParticipantsBoxController::ParticipantsBoxController(not_null channel, Role role) : PeerListController(CreateSearchController(channel, role, &_additional)) , _channel(channel) , _role(role) { if (_channel->mgInfo) { @@ -46,7 +46,7 @@ ParticipantsBoxController::ParticipantsBoxController(gsl::not_null } } -std::unique_ptr ParticipantsBoxController::CreateSearchController(gsl::not_null channel, Role role, gsl::not_null additional) { +std::unique_ptr ParticipantsBoxController::CreateSearchController(not_null channel, Role role, not_null additional) { // In admins box complex search is used for adding new admins. if (role != Role::Admins || channel->canAddAdmins()) { return std::make_unique(channel, role, additional); @@ -54,9 +54,9 @@ std::unique_ptr ParticipantsBoxController::CreateSearc return nullptr; } -void ParticipantsBoxController::Start(gsl::not_null channel, Role role) { +void ParticipantsBoxController::Start(not_null channel, Role role) { auto controller = std::make_unique(channel, role); - auto initBox = [role, channel, controller = controller.get()](gsl::not_null box) { + auto initBox = [role, channel, controller = controller.get()](not_null box) { box->addButton(langFactory(lng_close), [box] { box->closeBox(); }); auto canAddNewItem = [role, channel] { switch (role) { @@ -88,7 +88,7 @@ void ParticipantsBoxController::addNewItem() { if (_channel->membersCount() >= Global::ChatSizeMax()) { Ui::show(Box(_channel), KeepOtherLayers); } else { - auto already = std::vector>(); + auto already = std::vector>(); already.reserve(delegate()->peerListFullRowsCount()); for (auto i = 0, count = delegate()->peerListFullRowsCount(); i != count; ++i) { already.push_back(delegate()->peerListRowAt(i)->peer()->asUser()); @@ -98,27 +98,27 @@ void ParticipantsBoxController::addNewItem() { return; } auto weak = base::make_weak_unique(this); - _addBox = Ui::show(Box(std::make_unique(_channel, _role, [weak](gsl::not_null user, const MTPChannelAdminRights &rights) { + _addBox = Ui::show(Box(std::make_unique(_channel, _role, [weak](not_null user, const MTPChannelAdminRights &rights) { if (weak) { weak->editAdminDone(user, rights); } - }, [weak](gsl::not_null user, const MTPChannelBannedRights &rights) { + }, [weak](not_null user, const MTPChannelBannedRights &rights) { if (weak) { weak->editRestrictedDone(user, rights); } - }), [](gsl::not_null box) { + }), [](not_null box) { box->addButton(langFactory(lng_cancel), [box] { box->closeBox(); }); }), KeepOtherLayers); } -void ParticipantsBoxController::peerListSearchAddRow(gsl::not_null peer) { +void ParticipantsBoxController::peerListSearchAddRow(not_null peer) { PeerListController::peerListSearchAddRow(peer); if (_role == Role::Restricted && delegate()->peerListFullRowsCount() > 0) { setDescriptionText(QString()); } } -std::unique_ptr ParticipantsBoxController::createSearchRow(gsl::not_null peer) { +std::unique_ptr ParticipantsBoxController::createSearchRow(not_null peer) { if (auto user = peer->asUser()) { return createRow(user); } @@ -126,7 +126,7 @@ std::unique_ptr ParticipantsBoxController::createSearchRow(gsl::not } template -void ParticipantsBoxController::HandleParticipant(const MTPChannelParticipant &participant, Role role, gsl::not_null additional, Callback callback) { +void ParticipantsBoxController::HandleParticipant(const MTPChannelParticipant &participant, Role role, not_null additional, Callback callback) { if ((role == Role::Members || role == Role::Admins) && participant.type() == mtpc_channelParticipantAdmin) { auto &admin = participant.c_channelParticipantAdmin(); if (auto user = App::userLoaded(admin.vuser_id.v)) { @@ -245,7 +245,7 @@ void ParticipantsBoxController::loadMoreRows() { } else { for_const (auto &participant, list) { ++_offset; - HandleParticipant(participant, _role, &_additional, [this](gsl::not_null user) { + HandleParticipant(participant, _role, &_additional, [this](not_null user) { appendRow(user); }); } @@ -301,7 +301,7 @@ bool ParticipantsBoxController::feedMegagroupLastParticipants() { return true; } -void ParticipantsBoxController::rowClicked(gsl::not_null row) { +void ParticipantsBoxController::rowClicked(not_null row) { auto user = row->peer()->asUser(); Expects(user != nullptr); @@ -314,7 +314,7 @@ void ParticipantsBoxController::rowClicked(gsl::not_null row) { } } -void ParticipantsBoxController::rowActionClicked(gsl::not_null row) { +void ParticipantsBoxController::rowActionClicked(not_null row) { auto user = row->peer()->asUser(); Expects(user != nullptr); @@ -329,7 +329,7 @@ void ParticipantsBoxController::rowActionClicked(gsl::not_null row } } -void ParticipantsBoxController::showAdmin(gsl::not_null user) { +void ParticipantsBoxController::showAdmin(not_null user) { auto it = _additional.adminRights.find(user); auto isCreator = (user == _additional.creator); auto notAdmin = !isCreator && (it == _additional.adminRights.cend()); @@ -354,7 +354,7 @@ void ParticipantsBoxController::showAdmin(gsl::not_null user) { _editBox = Ui::show(std::move(box), KeepOtherLayers); } -void ParticipantsBoxController::editAdminDone(gsl::not_null user, const MTPChannelAdminRights &rights) { +void ParticipantsBoxController::editAdminDone(not_null user, const MTPChannelAdminRights &rights) { if (_editBox) { _editBox->closeBox(); } @@ -386,7 +386,7 @@ void ParticipantsBoxController::editAdminDone(gsl::not_null user, con delegate()->peerListRefreshRows(); } -void ParticipantsBoxController::showRestricted(gsl::not_null user) { +void ParticipantsBoxController::showRestricted(not_null user) { auto it = _additional.restrictedRights.find(user); if (it == _additional.restrictedRights.cend()) { return; @@ -408,7 +408,7 @@ void ParticipantsBoxController::showRestricted(gsl::not_null user) { _editBox = Ui::show(std::move(box), KeepOtherLayers); } -void ParticipantsBoxController::editRestrictedDone(gsl::not_null user, const MTPChannelBannedRights &rights) { +void ParticipantsBoxController::editRestrictedDone(not_null user, const MTPChannelBannedRights &rights) { if (_editBox) { _editBox->closeBox(); } @@ -450,7 +450,7 @@ void ParticipantsBoxController::editRestrictedDone(gsl::not_null user delegate()->peerListRefreshRows(); } -void ParticipantsBoxController::kickMember(gsl::not_null user) { +void ParticipantsBoxController::kickMember(not_null user) { auto text = (_channel->isMegagroup() ? lng_profile_sure_kick : lng_profile_sure_kick_channel)(lt_user, user->firstName); auto weak = base::make_weak_unique(this); _editBox = Ui::show(Box(text, lang(lng_box_remove), [weak, user] { @@ -460,7 +460,7 @@ void ParticipantsBoxController::kickMember(gsl::not_null user) { }), KeepOtherLayers); } -void ParticipantsBoxController::kickMemberSure(gsl::not_null user) { +void ParticipantsBoxController::kickMemberSure(not_null user) { if (_editBox) { _editBox->closeBox(); } @@ -474,14 +474,14 @@ void ParticipantsBoxController::kickMemberSure(gsl::not_null user) { Auth().api().kickParticipant(_channel, user, currentRights); } -void ParticipantsBoxController::removeKicked(gsl::not_null row, gsl::not_null user) { +void ParticipantsBoxController::removeKicked(not_null row, not_null user) { delegate()->peerListRemoveRow(row); delegate()->peerListRefreshRows(); Auth().api().unblockParticipant(_channel, user); } -bool ParticipantsBoxController::appendRow(gsl::not_null user) { +bool ParticipantsBoxController::appendRow(not_null user) { if (delegate()->peerListFindRow(user->id)) { return false; } @@ -492,7 +492,7 @@ bool ParticipantsBoxController::appendRow(gsl::not_null user) { return true; } -bool ParticipantsBoxController::prependRow(gsl::not_null user) { +bool ParticipantsBoxController::prependRow(not_null user) { if (auto row = delegate()->peerListFindRow(user->id)) { refreshCustomStatus(row); if (_role == Role::Admins) { @@ -508,7 +508,7 @@ bool ParticipantsBoxController::prependRow(gsl::not_null user) { return true; } -bool ParticipantsBoxController::removeRow(gsl::not_null user) { +bool ParticipantsBoxController::removeRow(not_null user) { if (auto row = delegate()->peerListFindRow(user->id)) { if (_role == Role::Admins) { // Perhaps we are removing an admin from search results. @@ -525,7 +525,7 @@ bool ParticipantsBoxController::removeRow(gsl::not_null user) { return false; } -std::unique_ptr ParticipantsBoxController::createRow(gsl::not_null user) const { +std::unique_ptr ParticipantsBoxController::createRow(not_null user) const { auto row = std::make_unique(user); refreshCustomStatus(row.get()); if (_role == Role::Restricted || (_role == Role::Admins && _additional.adminCanEdit.find(user) != _additional.adminCanEdit.cend())) { @@ -542,7 +542,7 @@ std::unique_ptr ParticipantsBoxController::createRow(gsl::not_null< return std::move(row); } -void ParticipantsBoxController::refreshCustomStatus(gsl::not_null row) const { +void ParticipantsBoxController::refreshCustomStatus(not_null row) const { auto user = row->peer()->asUser(); if (_role == Role::Admins) { auto promotedBy = _additional.adminPromotedBy.find(user); @@ -565,7 +565,7 @@ void ParticipantsBoxController::refreshCustomStatus(gsl::not_null } } -ParticipantsBoxSearchController::ParticipantsBoxSearchController(gsl::not_null channel, Role role, gsl::not_null additional) +ParticipantsBoxSearchController::ParticipantsBoxSearchController(not_null channel, Role role, not_null additional) : _channel(channel) , _role(role) , _additional(additional) { @@ -672,7 +672,7 @@ void ParticipantsBoxSearchController::searchDone(mtpRequestId requestId, const M } auto parseRole = (_role == Role::Admins) ? Role::Members : _role; for_const (auto &participant, list) { - ParticipantsBoxController::HandleParticipant(participant, parseRole, _additional, [this](gsl::not_null user) { + ParticipantsBoxController::HandleParticipant(participant, parseRole, _additional, [this](not_null user) { delegate()->peerListSearchAddRow(user); }); } @@ -681,7 +681,7 @@ void ParticipantsBoxSearchController::searchDone(mtpRequestId requestId, const M } } -AddParticipantBoxController::AddParticipantBoxController(gsl::not_null channel, Role role, AdminDoneCallback adminDoneCallback, BannedDoneCallback bannedDoneCallback) : PeerListController(std::make_unique(channel, &_additional)) +AddParticipantBoxController::AddParticipantBoxController(not_null channel, Role role, AdminDoneCallback adminDoneCallback, BannedDoneCallback bannedDoneCallback) : PeerListController(std::make_unique(channel, &_additional)) , _channel(channel) , _role(role) , _adminDoneCallback(std::move(adminDoneCallback)) @@ -691,7 +691,7 @@ AddParticipantBoxController::AddParticipantBoxController(gsl::not_null AddParticipantBoxController::createSearchRow(gsl::not_null peer) { +std::unique_ptr AddParticipantBoxController::createSearchRow(not_null peer) { if (peer->isSelf()) { return nullptr; } @@ -744,7 +744,7 @@ void AddParticipantBoxController::loadMoreRows() { } else { for_const (auto &participant, list) { ++_offset; - HandleParticipant(participant, &_additional, [this](gsl::not_null user) { + HandleParticipant(participant, &_additional, [this](not_null user) { appendRow(user); }); } @@ -760,7 +760,7 @@ void AddParticipantBoxController::loadMoreRows() { }).send(); } -void AddParticipantBoxController::rowClicked(gsl::not_null row) { +void AddParticipantBoxController::rowClicked(not_null row) { auto user = row->peer()->asUser(); switch (_role) { case Role::Admins: return showAdmin(user); @@ -771,7 +771,7 @@ void AddParticipantBoxController::rowClicked(gsl::not_null row) { } template -bool AddParticipantBoxController::checkInfoLoaded(gsl::not_null user, Callback callback) { +bool AddParticipantBoxController::checkInfoLoaded(not_null user, Callback callback) { if (_additional.infoNotLoaded.find(user) == _additional.infoNotLoaded.end()) { return true; } @@ -781,7 +781,7 @@ bool AddParticipantBoxController::checkInfoLoaded(gsl::not_null user, Expects(result.type() == mtpc_channels_channelParticipant); auto &participant = result.c_channels_channelParticipant(); App::feedUsers(participant.vusers); - HandleParticipant(participant.vparticipant, &_additional, [](gsl::not_null) {}); + HandleParticipant(participant.vparticipant, &_additional, [](not_null) {}); _additional.infoNotLoaded.erase(user); callback(); }).fail([this, user, callback](const RPCError &error) { @@ -792,7 +792,7 @@ bool AddParticipantBoxController::checkInfoLoaded(gsl::not_null user, return false; } -void AddParticipantBoxController::showAdmin(gsl::not_null user, bool sure) { +void AddParticipantBoxController::showAdmin(not_null user, bool sure) { if (!checkInfoLoaded(user, [this, user] { showAdmin(user); })) { return; } @@ -895,7 +895,7 @@ void AddParticipantBoxController::showAdmin(gsl::not_null user, bool _editBox = Ui::show(std::move(box), KeepOtherLayers); } -void AddParticipantBoxController::editAdminDone(gsl::not_null user, const MTPChannelAdminRights &rights) { +void AddParticipantBoxController::editAdminDone(not_null user, const MTPChannelAdminRights &rights) { if (_editBox) _editBox->closeBox(); _additional.restrictedRights.erase(user); _additional.restrictedBy.erase(user); @@ -918,7 +918,7 @@ void AddParticipantBoxController::editAdminDone(gsl::not_null user, c } } -void AddParticipantBoxController::showRestricted(gsl::not_null user, bool sure) { +void AddParticipantBoxController::showRestricted(not_null user, bool sure) { if (!checkInfoLoaded(user, [this, user] { showRestricted(user); })) { return; } @@ -964,7 +964,7 @@ void AddParticipantBoxController::showRestricted(gsl::not_null user, _editBox = Ui::show(std::move(box), KeepOtherLayers); } -void AddParticipantBoxController::restrictUserSure(gsl::not_null user, const MTPChannelBannedRights &oldRights, const MTPChannelBannedRights &newRights) { +void AddParticipantBoxController::restrictUserSure(not_null user, const MTPChannelBannedRights &oldRights, const MTPChannelBannedRights &newRights) { auto weak = base::make_weak_unique(this); MTP::send(MTPchannels_EditBanned(_channel->inputChannel, user->inputUser, newRights), rpcDone([megagroup = _channel.get(), user, weak, oldRights, newRights](const MTPUpdates &result) { Auth().api().applyUpdates(result); @@ -975,7 +975,7 @@ void AddParticipantBoxController::restrictUserSure(gsl::not_null user })); } -void AddParticipantBoxController::editRestrictedDone(gsl::not_null user, const MTPChannelBannedRights &rights) { +void AddParticipantBoxController::editRestrictedDone(not_null user, const MTPChannelBannedRights &rights) { if (_editBox) _editBox->closeBox(); _additional.adminRights.erase(user); _additional.adminCanEdit.erase(user); @@ -998,7 +998,7 @@ void AddParticipantBoxController::editRestrictedDone(gsl::not_null us } } -void AddParticipantBoxController::kickUser(gsl::not_null user, bool sure) { +void AddParticipantBoxController::kickUser(not_null user, bool sure) { if (!checkInfoLoaded(user, [this, user] { kickUser(user); })) { return; } @@ -1041,7 +1041,7 @@ void AddParticipantBoxController::kickUser(gsl::not_null user, bool s restrictUserSure(user, currentRights, ChannelData::KickedRestrictedRights()); } -bool AddParticipantBoxController::appendRow(gsl::not_null user) { +bool AddParticipantBoxController::appendRow(not_null user) { if (delegate()->peerListFindRow(user->id) || user->isSelf()) { return false; } @@ -1049,7 +1049,7 @@ bool AddParticipantBoxController::appendRow(gsl::not_null user) { return true; } -bool AddParticipantBoxController::prependRow(gsl::not_null user) { +bool AddParticipantBoxController::prependRow(not_null user) { if (delegate()->peerListFindRow(user->id)) { return false; } @@ -1057,12 +1057,12 @@ bool AddParticipantBoxController::prependRow(gsl::not_null user) { return true; } -std::unique_ptr AddParticipantBoxController::createRow(gsl::not_null user) const { +std::unique_ptr AddParticipantBoxController::createRow(not_null user) const { return std::make_unique(user); } template -void AddParticipantBoxController::HandleParticipant(const MTPChannelParticipant &participant, gsl::not_null additional, Callback callback) { +void AddParticipantBoxController::HandleParticipant(const MTPChannelParticipant &participant, not_null additional, Callback callback) { switch (participant.type()) { case mtpc_channelParticipantAdmin: { auto &admin = participant.c_channelParticipantAdmin(); @@ -1139,7 +1139,7 @@ void AddParticipantBoxController::HandleParticipant(const MTPChannelParticipant } } -AddParticipantBoxSearchController::AddParticipantBoxSearchController(gsl::not_null channel, gsl::not_null additional) +AddParticipantBoxSearchController::AddParticipantBoxSearchController(not_null channel, not_null additional) : _channel(channel) , _additional(additional) { _timer.setCallback([this] { searchOnServer(); }); @@ -1264,7 +1264,7 @@ void AddParticipantBoxSearchController::searchParticipantsDone(mtpRequestId requ } } for_const (auto &participant, list) { - AddParticipantBoxController::HandleParticipant(participant, _additional, [this](gsl::not_null user) { + AddParticipantBoxController::HandleParticipant(participant, _additional, [this](not_null user) { delegate()->peerListSearchAddRow(user); }); } diff --git a/Telegram/SourceFiles/profile/profile_channel_controllers.h b/Telegram/SourceFiles/profile/profile_channel_controllers.h index 5177f88c2b..968b7f513f 100644 --- a/Telegram/SourceFiles/profile/profile_channel_controllers.h +++ b/Telegram/SourceFiles/profile/profile_channel_controllers.h @@ -35,56 +35,56 @@ public: Restricted, Kicked, }; - static void Start(gsl::not_null channel, Role role); + static void Start(not_null channel, Role role); struct Additional { - std::map, MTPChannelAdminRights> adminRights; - std::set> adminCanEdit; - std::map, gsl::not_null> adminPromotedBy; - std::map, MTPChannelBannedRights> restrictedRights; - std::set> kicked; - std::map, gsl::not_null> restrictedBy; - std::set> external; - std::set> infoNotLoaded; + std::map, MTPChannelAdminRights> adminRights; + std::set> adminCanEdit; + std::map, not_null> adminPromotedBy; + std::map, MTPChannelBannedRights> restrictedRights; + std::set> kicked; + std::map, not_null> restrictedBy; + std::set> external; + std::set> infoNotLoaded; UserData *creator = nullptr; }; - ParticipantsBoxController(gsl::not_null channel, Role role); + ParticipantsBoxController(not_null channel, Role role); void addNewItem(); void prepare() override; - void rowClicked(gsl::not_null row) override; - void rowActionClicked(gsl::not_null row) override; + void rowClicked(not_null row) override; + void rowActionClicked(not_null row) override; void loadMoreRows() override; - void peerListSearchAddRow(gsl::not_null peer) override; - std::unique_ptr createSearchRow(gsl::not_null peer) override; + void peerListSearchAddRow(not_null peer) override; + std::unique_ptr createSearchRow(not_null peer) override; - // Callback(gsl::not_null) + // Callback(not_null) template - static void HandleParticipant(const MTPChannelParticipant &participant, Role role, gsl::not_null additional, Callback callback); + static void HandleParticipant(const MTPChannelParticipant &participant, Role role, not_null additional, Callback callback); protected: - virtual std::unique_ptr createRow(gsl::not_null user) const; + virtual std::unique_ptr createRow(not_null user) const; private: - static std::unique_ptr CreateSearchController(gsl::not_null channel, Role role, gsl::not_null additional); + static std::unique_ptr CreateSearchController(not_null channel, Role role, not_null additional); - void showAdmin(gsl::not_null user); - void editAdminDone(gsl::not_null user, const MTPChannelAdminRights &rights); - void showRestricted(gsl::not_null user); - void editRestrictedDone(gsl::not_null user, const MTPChannelBannedRights &rights); - void removeKicked(gsl::not_null row, gsl::not_null user); - void kickMember(gsl::not_null user); - void kickMemberSure(gsl::not_null user); - bool appendRow(gsl::not_null user); - bool prependRow(gsl::not_null user); - bool removeRow(gsl::not_null user); - void refreshCustomStatus(gsl::not_null row) const; + void showAdmin(not_null user); + void editAdminDone(not_null user, const MTPChannelAdminRights &rights); + void showRestricted(not_null user); + void editRestrictedDone(not_null user, const MTPChannelBannedRights &rights); + void removeKicked(not_null row, not_null user); + void kickMember(not_null user); + void kickMemberSure(not_null user); + bool appendRow(not_null user); + bool prependRow(not_null user); + bool removeRow(not_null user); + void refreshCustomStatus(not_null row) const; bool feedMegagroupLastParticipants(); - gsl::not_null _channel; + not_null _channel; Role _role = Role::Admins; int _offset = 0; mtpRequestId _loadRequestId = 0; @@ -101,7 +101,7 @@ public: using Role = ParticipantsBoxController::Role; using Additional = ParticipantsBoxController::Additional; - ParticipantsBoxSearchController(gsl::not_null channel, Role role, gsl::not_null additional); + ParticipantsBoxSearchController(not_null channel, Role role, not_null additional); void searchQuery(const QString &query) override; bool isLoading() override; @@ -121,9 +121,9 @@ private: bool searchInCache(); void searchDone(mtpRequestId requestId, const MTPchannels_ChannelParticipants &result, int requestedCount); - gsl::not_null _channel; + not_null _channel; Role _role = Role::Restricted; - gsl::not_null _additional; + not_null _additional; base::Timer _timer; QString _query; @@ -141,35 +141,35 @@ public: using Role = ParticipantsBoxController::Role; using Additional = ParticipantsBoxController::Additional; - using AdminDoneCallback = base::lambda user, const MTPChannelAdminRights &adminRights)>; - using BannedDoneCallback = base::lambda user, const MTPChannelBannedRights &bannedRights)>; - AddParticipantBoxController(gsl::not_null channel, Role role, AdminDoneCallback adminDoneCallback, BannedDoneCallback bannedDoneCallback); + using AdminDoneCallback = base::lambda user, const MTPChannelAdminRights &adminRights)>; + using BannedDoneCallback = base::lambda user, const MTPChannelBannedRights &bannedRights)>; + AddParticipantBoxController(not_null channel, Role role, AdminDoneCallback adminDoneCallback, BannedDoneCallback bannedDoneCallback); void prepare() override; - void rowClicked(gsl::not_null row) override; + void rowClicked(not_null row) override; void loadMoreRows() override; - std::unique_ptr createSearchRow(gsl::not_null peer) override; + std::unique_ptr createSearchRow(not_null peer) override; - // Callback(gsl::not_null) + // Callback(not_null) template - static void HandleParticipant(const MTPChannelParticipant &participant, gsl::not_null additional, Callback callback); + static void HandleParticipant(const MTPChannelParticipant &participant, not_null additional, Callback callback); private: template - bool checkInfoLoaded(gsl::not_null user, Callback callback); + bool checkInfoLoaded(not_null user, Callback callback); - void showAdmin(gsl::not_null user, bool sure = false); - void editAdminDone(gsl::not_null user, const MTPChannelAdminRights &rights); - void showRestricted(gsl::not_null user, bool sure = false); - void editRestrictedDone(gsl::not_null user, const MTPChannelBannedRights &rights); - void kickUser(gsl::not_null user, bool sure = false); - void restrictUserSure(gsl::not_null user, const MTPChannelBannedRights &oldRights, const MTPChannelBannedRights &newRights); - bool appendRow(gsl::not_null user); - bool prependRow(gsl::not_null user); - std::unique_ptr createRow(gsl::not_null user) const; + void showAdmin(not_null user, bool sure = false); + void editAdminDone(not_null user, const MTPChannelAdminRights &rights); + void showRestricted(not_null user, bool sure = false); + void editRestrictedDone(not_null user, const MTPChannelBannedRights &rights); + void kickUser(not_null user, bool sure = false); + void restrictUserSure(not_null user, const MTPChannelBannedRights &oldRights, const MTPChannelBannedRights &newRights); + bool appendRow(not_null user); + bool prependRow(not_null user); + std::unique_ptr createRow(not_null user) const; - gsl::not_null _channel; + not_null _channel; Role _role = Role::Admins; int _offset = 0; mtpRequestId _loadRequestId = 0; @@ -187,7 +187,7 @@ public: using Role = ParticipantsBoxController::Role; using Additional = ParticipantsBoxController::Additional; - AddParticipantBoxSearchController(gsl::not_null channel, gsl::not_null additional); + AddParticipantBoxSearchController(not_null channel, not_null additional); void searchQuery(const QString &query) override; bool isLoading() override; @@ -212,8 +212,8 @@ private: void addChatsContacts(); void requestGlobal(); - gsl::not_null _channel; - gsl::not_null _additional; + not_null _channel; + not_null _additional; base::Timer _timer; QString _query; diff --git a/Telegram/SourceFiles/profile/profile_common_groups_section.cpp b/Telegram/SourceFiles/profile/profile_common_groups_section.cpp index 77b25cc2ae..25a9c7f2af 100644 --- a/Telegram/SourceFiles/profile/profile_common_groups_section.cpp +++ b/Telegram/SourceFiles/profile/profile_common_groups_section.cpp @@ -42,7 +42,7 @@ constexpr int kCommonGroupsPerPage = 40; } // namespace -object_ptr SectionMemento::createWidget(QWidget *parent, gsl::not_null controller, const QRect &geometry) { +object_ptr SectionMemento::createWidget(QWidget *parent, not_null controller, const QRect &geometry) { auto result = object_ptr(parent, controller, _user); result->setInternalState(geometry, this); return std::move(result); @@ -97,7 +97,7 @@ InnerWidget::Item::Item(PeerData *peer) : peer(peer) { InnerWidget::Item::~Item() = default; -InnerWidget::InnerWidget(QWidget *parent, gsl::not_null user) : TWidget(parent) +InnerWidget::InnerWidget(QWidget *parent, not_null user) : TWidget(parent) , _user(user) { setMouseTracking(true); setAttribute(Qt::WA_OpaquePaintEvent); @@ -118,9 +118,9 @@ void InnerWidget::checkPreloadMore() { } } -void InnerWidget::saveState(gsl::not_null memento) { +void InnerWidget::saveState(not_null memento) { if (auto count = _items.size()) { - QList> groups; + QList> groups; groups.reserve(count); for_const (auto item, _items) { groups.push_back(item->peer); @@ -129,7 +129,7 @@ void InnerWidget::saveState(gsl::not_null memento) { } } -void InnerWidget::restoreState(gsl::not_null memento) { +void InnerWidget::restoreState(not_null memento) { auto list = memento->getCommonGroups(); _allLoaded = false; if (!list.empty()) { @@ -137,7 +137,7 @@ void InnerWidget::restoreState(gsl::not_null memento) { } } -void InnerWidget::showInitial(const QList> &list) { +void InnerWidget::showInitial(const QList> &list) { for_const (auto group, list) { if (auto item = computeItem(group)) { _items.push_back(item); @@ -335,7 +335,7 @@ InnerWidget::~InnerWidget() { } } -Widget::Widget(QWidget *parent, gsl::not_null controller, gsl::not_null user) : Window::SectionWidget(parent, controller) +Widget::Widget(QWidget *parent, not_null controller, not_null user) : Window::SectionWidget(parent, controller) , _scroll(this, st::settingsScroll) , _fixedBar(this) , _fixedBarShadow(this, st::shadowFg) { @@ -359,7 +359,7 @@ void Widget::updateAdaptiveLayout() { _fixedBarShadow->moveToLeft(Adaptive::OneColumn() ? 0 : st::lineWidth, _fixedBar->height()); } -gsl::not_null Widget::user() const { +not_null Widget::user() const { return _inner->user(); } @@ -374,7 +374,7 @@ void Widget::doSetInnerFocus() { _inner->setFocus(); } -bool Widget::showInternal(gsl::not_null memento) { +bool Widget::showInternal(not_null memento) { if (auto profileMemento = dynamic_cast(memento.get())) { if (profileMemento->getUser() == user()) { restoreState(profileMemento); @@ -384,7 +384,7 @@ bool Widget::showInternal(gsl::not_null memento) { return false; } -void Widget::setInternalState(const QRect &geometry, gsl::not_null memento) { +void Widget::setInternalState(const QRect &geometry, not_null memento) { setGeometry(geometry); myEnsureResized(this); restoreState(memento); @@ -396,12 +396,12 @@ std::unique_ptr Widget::createMemento() { return std::move(result); } -void Widget::saveState(gsl::not_null memento) { +void Widget::saveState(not_null memento) { memento->setScrollTop(_scroll->scrollTop()); _inner->saveState(memento); } -void Widget::restoreState(gsl::not_null memento) { +void Widget::restoreState(not_null memento) { _inner->restoreState(memento); auto scrollTop = memento->getScrollTop(); _scroll->scrollToY(scrollTop); diff --git a/Telegram/SourceFiles/profile/profile_common_groups_section.h b/Telegram/SourceFiles/profile/profile_common_groups_section.h index 808990dafa..a23a614880 100644 --- a/Telegram/SourceFiles/profile/profile_common_groups_section.h +++ b/Telegram/SourceFiles/profile/profile_common_groups_section.h @@ -40,12 +40,12 @@ namespace CommonGroups { class SectionMemento : public Window::SectionMemento { public: - SectionMemento(gsl::not_null user) : _user(user) { + SectionMemento(not_null user) : _user(user) { } - object_ptr createWidget(QWidget *parent, gsl::not_null controller, const QRect &geometry) override; + object_ptr createWidget(QWidget *parent, not_null controller, const QRect &geometry) override; - gsl::not_null getUser() const { + not_null getUser() const { return _user; } void setScrollTop(int scrollTop) { @@ -54,17 +54,17 @@ public: int getScrollTop() const { return _scrollTop; } - void setCommonGroups(const QList> &groups) { + void setCommonGroups(const QList> &groups) { _commonGroups = groups; } - const QList> &getCommonGroups() const { + const QList> &getCommonGroups() const { return _commonGroups; } private: - gsl::not_null _user; + not_null _user; int _scrollTop = 0; - QList> _commonGroups; + QList> _commonGroups; }; @@ -96,9 +96,9 @@ class InnerWidget final : public TWidget { Q_OBJECT public: - InnerWidget(QWidget *parent, gsl::not_null user); + InnerWidget(QWidget *parent, not_null user); - gsl::not_null user() const { + not_null user() const { return _user; } @@ -110,8 +110,8 @@ public: return TWidget::resizeToWidth(newWidth); } - void saveState(gsl::not_null memento); - void restoreState(gsl::not_null memento); + void saveState(not_null memento); + void restoreState(not_null memento); ~InnerWidget(); @@ -131,13 +131,13 @@ protected: private: void updateSelected(QPoint localPos); void updateRow(int index); - void showInitial(const QList> &list); + void showInitial(const QList> &list); void checkPreloadMore(); void preloadMore(); void updateSize(); void paintRow(Painter &p, int index, TimeMs ms); - gsl::not_null _user; + not_null _user; int _minHeight = 0; int _rowHeight = 0; @@ -171,9 +171,9 @@ class Widget final : public Window::SectionWidget { Q_OBJECT public: - Widget(QWidget *parent, gsl::not_null controller, gsl::not_null user); + Widget(QWidget *parent, not_null controller, not_null user); - gsl::not_null user() const; + not_null user() const; PeerData *peerForDialogs() const override { return user(); } @@ -184,10 +184,10 @@ public: QPixmap grabForShowAnimation(const Window::SectionSlideParams ¶ms) override; - bool showInternal(gsl::not_null memento) override; + bool showInternal(not_null memento) override; std::unique_ptr createMemento() override; - void setInternalState(const QRect &geometry, gsl::not_null memento); + void setInternalState(const QRect &geometry, not_null memento); // Float player interface. bool wheelEventFromFloatPlayer(QEvent *e, Window::Column myColumn, Window::Column playerColumn) override; @@ -205,8 +205,8 @@ private slots: private: void updateAdaptiveLayout(); - void saveState(gsl::not_null memento); - void restoreState(gsl::not_null memento); + void saveState(not_null memento); + void restoreState(not_null memento); object_ptr _scroll; QPointer _inner; diff --git a/Telegram/SourceFiles/profile/profile_inner_widget.cpp b/Telegram/SourceFiles/profile/profile_inner_widget.cpp index 2c7a187c5d..07abb95650 100644 --- a/Telegram/SourceFiles/profile/profile_inner_widget.cpp +++ b/Telegram/SourceFiles/profile/profile_inner_widget.cpp @@ -89,13 +89,13 @@ bool InnerWidget::shareContactButtonShown() const { return _cover->shareContactButtonShown(); } -void InnerWidget::saveState(gsl::not_null memento) { +void InnerWidget::saveState(not_null memento) { for_const (auto &blockData, _blocks) { blockData.block->saveState(memento); } } -void InnerWidget::restoreState(gsl::not_null memento) { +void InnerWidget::restoreState(not_null memento) { for_const (auto &blockData, _blocks) { blockData.block->restoreState(memento); } diff --git a/Telegram/SourceFiles/profile/profile_inner_widget.h b/Telegram/SourceFiles/profile/profile_inner_widget.h index aa3b5d7891..b230b4e1e3 100644 --- a/Telegram/SourceFiles/profile/profile_inner_widget.h +++ b/Telegram/SourceFiles/profile/profile_inner_widget.h @@ -49,8 +49,8 @@ public: // It should show it only if it is hidden in the cover. bool shareContactButtonShown() const; - void saveState(gsl::not_null memento); - void restoreState(gsl::not_null memento); + void saveState(not_null memento); + void restoreState(not_null memento); void showFinished(); diff --git a/Telegram/SourceFiles/profile/profile_section_memento.cpp b/Telegram/SourceFiles/profile/profile_section_memento.cpp index c07bbe4118..d6d53e5585 100644 --- a/Telegram/SourceFiles/profile/profile_section_memento.cpp +++ b/Telegram/SourceFiles/profile/profile_section_memento.cpp @@ -24,7 +24,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org namespace Profile { -object_ptr SectionMemento::createWidget(QWidget *parent, gsl::not_null controller, const QRect &geometry) { +object_ptr SectionMemento::createWidget(QWidget *parent, not_null controller, const QRect &geometry) { auto result = object_ptr(parent, controller, _peer); result->setInternalState(geometry, this); return std::move(result); diff --git a/Telegram/SourceFiles/profile/profile_section_memento.h b/Telegram/SourceFiles/profile/profile_section_memento.h index cc7140ad79..ca6f44785b 100644 --- a/Telegram/SourceFiles/profile/profile_section_memento.h +++ b/Telegram/SourceFiles/profile/profile_section_memento.h @@ -31,7 +31,7 @@ public: SectionMemento(PeerData *peer) : _peer(peer) { } - object_ptr createWidget(QWidget *parent, gsl::not_null controller, const QRect &geometry) override; + object_ptr createWidget(QWidget *parent, not_null controller, const QRect &geometry) override; PeerData *getPeer() const { return _peer; diff --git a/Telegram/SourceFiles/profile/profile_widget.cpp b/Telegram/SourceFiles/profile/profile_widget.cpp index c70c2ef1aa..f9dc74c9d6 100644 --- a/Telegram/SourceFiles/profile/profile_widget.cpp +++ b/Telegram/SourceFiles/profile/profile_widget.cpp @@ -32,7 +32,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org namespace Profile { -Widget::Widget(QWidget *parent, gsl::not_null controller, PeerData *peer) : Window::SectionWidget(parent, controller) +Widget::Widget(QWidget *parent, not_null controller, PeerData *peer) : Window::SectionWidget(parent, controller) , _scroll(this, st::settingsScroll) , _fixedBar(this, peer) , _fixedBarShadow(this, object_ptr(this, st::shadowFg)) { @@ -76,7 +76,7 @@ void Widget::doSetInnerFocus() { _inner->setFocus(); } -bool Widget::showInternal(gsl::not_null memento) { +bool Widget::showInternal(not_null memento) { if (auto profileMemento = dynamic_cast(memento.get())) { if (profileMemento->getPeer() == peer()) { restoreState(profileMemento); @@ -86,7 +86,7 @@ bool Widget::showInternal(gsl::not_null memento) { return false; } -void Widget::setInternalState(const QRect &geometry, gsl::not_null memento) { +void Widget::setInternalState(const QRect &geometry, not_null memento) { setGeometry(geometry); myEnsureResized(this); restoreState(memento); @@ -98,12 +98,12 @@ std::unique_ptr Widget::createMemento() { return std::move(result); } -void Widget::saveState(gsl::not_null memento) { +void Widget::saveState(not_null memento) { memento->setScrollTop(_scroll->scrollTop()); _inner->saveState(memento); } -void Widget::restoreState(gsl::not_null memento) { +void Widget::restoreState(not_null memento) { _inner->restoreState(memento); auto scrollTop = memento->getScrollTop(); _scroll->scrollToY(scrollTop); diff --git a/Telegram/SourceFiles/profile/profile_widget.h b/Telegram/SourceFiles/profile/profile_widget.h index 82438996dc..6ce454a4be 100644 --- a/Telegram/SourceFiles/profile/profile_widget.h +++ b/Telegram/SourceFiles/profile/profile_widget.h @@ -38,7 +38,7 @@ class Widget final : public Window::SectionWidget { Q_OBJECT public: - Widget(QWidget *parent, gsl::not_null controller, PeerData *peer); + Widget(QWidget *parent, not_null controller, PeerData *peer); PeerData *peer() const; PeerData *peerForDialogs() const override { @@ -49,10 +49,10 @@ public: QPixmap grabForShowAnimation(const Window::SectionSlideParams ¶ms) override; - bool showInternal(gsl::not_null memento) override; + bool showInternal(not_null memento) override; std::unique_ptr createMemento() override; - void setInternalState(const QRect &geometry, gsl::not_null memento); + void setInternalState(const QRect &geometry, not_null memento); // Float player interface. bool wheelEventFromFloatPlayer(QEvent *e, Window::Column myColumn, Window::Column playerColumn) override; @@ -71,8 +71,8 @@ private slots: private: void updateScrollState(); void updateAdaptiveLayout(); - void saveState(gsl::not_null memento); - void restoreState(gsl::not_null memento); + void saveState(not_null memento); + void restoreState(not_null memento); object_ptr _scroll; QPointer _inner; diff --git a/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp b/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp index 9ae43554f8..e421a540cf 100644 --- a/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp +++ b/Telegram/SourceFiles/settings/settings_privacy_controllers.cpp @@ -36,24 +36,24 @@ constexpr auto kBlockedPerPage = 40; class BlockUserBoxController : public ChatsListBoxController { public: - void rowClicked(gsl::not_null row) override; + void rowClicked(not_null row) override; - void setBlockUserCallback(base::lambda user)> callback) { + void setBlockUserCallback(base::lambda user)> callback) { _blockUserCallback = std::move(callback); } protected: void prepareViewHook() override; - std::unique_ptr createRow(gsl::not_null history) override; - void updateRowHook(gsl::not_null row) override { + std::unique_ptr createRow(not_null history) override; + void updateRowHook(not_null row) override { updateIsBlocked(row, row->peer()->asUser()); delegate()->peerListUpdateRow(row); } private: - void updateIsBlocked(gsl::not_null row, UserData *user) const; + void updateIsBlocked(not_null row, UserData *user) const; - base::lambda user)> _blockUserCallback; + base::lambda user)> _blockUserCallback; }; @@ -69,7 +69,7 @@ void BlockUserBoxController::prepareViewHook() { })); } -void BlockUserBoxController::updateIsBlocked(gsl::not_null row, UserData *user) const { +void BlockUserBoxController::updateIsBlocked(not_null row, UserData *user) const { auto blocked = user->isBlocked(); row->setDisabledState(blocked ? PeerListRow::State::DisabledChecked : PeerListRow::State::Active); if (blocked) { @@ -79,11 +79,11 @@ void BlockUserBoxController::updateIsBlocked(gsl::not_null row, Us } } -void BlockUserBoxController::rowClicked(gsl::not_null row) { +void BlockUserBoxController::rowClicked(not_null row) { _blockUserCallback(row->peer()->asUser()); } -std::unique_ptr BlockUserBoxController::createRow(gsl::not_null history) { +std::unique_ptr BlockUserBoxController::createRow(not_null history) { if (history->peer->isSelf()) { return nullptr; } @@ -142,11 +142,11 @@ void BlockedBoxController::loadMoreRows() { }).send(); } -void BlockedBoxController::rowClicked(gsl::not_null row) { +void BlockedBoxController::rowClicked(not_null row) { Ui::showPeerHistoryAsync(row->peer()->id, ShowAtUnreadMsgId); } -void BlockedBoxController::rowActionClicked(gsl::not_null row) { +void BlockedBoxController::rowActionClicked(not_null row) { auto user = row->peer()->asUser(); Expects(user != nullptr); @@ -187,8 +187,8 @@ void BlockedBoxController::handleBlockedEvent(UserData *user) { void BlockedBoxController::BlockNewUser() { auto controller = std::make_unique(); - auto initBox = [controller = controller.get()](gsl::not_null box) { - controller->setBlockUserCallback([box](gsl::not_null user) { + auto initBox = [controller = controller.get()](not_null box) { + controller->setBlockUserCallback([box](not_null user) { Auth().api().blockUser(user); box->closeBox(); }); diff --git a/Telegram/SourceFiles/settings/settings_privacy_controllers.h b/Telegram/SourceFiles/settings/settings_privacy_controllers.h index 550e06d307..872c0f9873 100644 --- a/Telegram/SourceFiles/settings/settings_privacy_controllers.h +++ b/Telegram/SourceFiles/settings/settings_privacy_controllers.h @@ -29,8 +29,8 @@ namespace Settings { class BlockedBoxController : public PeerListController, private base::Subscriber, private MTP::Sender { public: void prepare() override; - void rowClicked(gsl::not_null row) override; - void rowActionClicked(gsl::not_null row) override; + void rowClicked(not_null row) override; + void rowActionClicked(not_null row) override; void loadMoreRows() override; static void BlockNewUser(); diff --git a/Telegram/SourceFiles/settings/settings_privacy_widget.cpp b/Telegram/SourceFiles/settings/settings_privacy_widget.cpp index 3aa3141cee..3e6b8b3342 100644 --- a/Telegram/SourceFiles/settings/settings_privacy_widget.cpp +++ b/Telegram/SourceFiles/settings/settings_privacy_widget.cpp @@ -208,7 +208,7 @@ void PrivacyWidget::autoLockUpdated() { } void PrivacyWidget::onBlockedUsers() { - Ui::show(Box(std::make_unique(), [](gsl::not_null box) { + Ui::show(Box(std::make_unique(), [](not_null box) { box->addButton(langFactory(lng_close), [box] { box->closeBox(); }); box->addLeftButton(langFactory(lng_blocked_list_add), [box] { BlockedBoxController::BlockNewUser(); }); })); diff --git a/Telegram/SourceFiles/storage/file_download.h b/Telegram/SourceFiles/storage/file_download.h index d79dc1b303..578513b2fc 100644 --- a/Telegram/SourceFiles/storage/file_download.h +++ b/Telegram/SourceFiles/storage/file_download.h @@ -147,7 +147,7 @@ signals: protected: void readImage(const QSize &shrinkBox) const; - gsl::not_null _downloader; + not_null _downloader; FileLoader *_prev = nullptr; FileLoader *_next = nullptr; int _priority = 0; diff --git a/Telegram/SourceFiles/structs.cpp b/Telegram/SourceFiles/structs.cpp index 7aea4ab3fe..7c4136c33f 100644 --- a/Telegram/SourceFiles/structs.cpp +++ b/Telegram/SourceFiles/structs.cpp @@ -250,7 +250,7 @@ using UpdateFlag = Notify::PeerUpdate::Flag; NotifySettings globalNotifyAll, globalNotifyUsers, globalNotifyChats; NotifySettingsPtr globalNotifyAllPtr = UnknownNotifySettings, globalNotifyUsersPtr = UnknownNotifySettings, globalNotifyChatsPtr = UnknownNotifySettings; -PeerClickHandler::PeerClickHandler(gsl::not_null peer) : _peer(peer) { +PeerClickHandler::PeerClickHandler(not_null peer) : _peer(peer) { } void PeerClickHandler::onClick(Qt::MouseButton button) const { @@ -790,7 +790,7 @@ MTPChannelBannedRights ChannelData::KickedRestrictedRights() { return MTP_channelBannedRights(MTP_flags(flags), MTP_int(std::numeric_limits::max())); } -void ChannelData::applyEditAdmin(gsl::not_null user, const MTPChannelAdminRights &oldRights, const MTPChannelAdminRights &newRights) { +void ChannelData::applyEditAdmin(not_null user, const MTPChannelAdminRights &oldRights, const MTPChannelAdminRights &newRights) { auto flags = Notify::PeerUpdate::Flag::AdminsChanged | Notify::PeerUpdate::Flag::None; if (mgInfo) { if (!mgInfo->lastParticipants.contains(user)) { // If rights are empty - still add participant? TODO check @@ -845,7 +845,7 @@ void ChannelData::applyEditAdmin(gsl::not_null user, const MTPChannel Notify::peerUpdatedDelayed(this, flags); } -void ChannelData::applyEditBanned(gsl::not_null user, const MTPChannelBannedRights &oldRights, const MTPChannelBannedRights &newRights) { +void ChannelData::applyEditBanned(not_null user, const MTPChannelBannedRights &oldRights, const MTPChannelBannedRights &newRights) { auto flags = Notify::PeerUpdate::Flag::BannedUsersChanged | Notify::PeerUpdate::Flag::None; if (mgInfo) { if (mgInfo->lastAdmins.contains(user)) { // If rights are empty - still remove admin? TODO check @@ -915,7 +915,7 @@ void ChannelData::setRestrictionReason(const QString &text) { } } -bool ChannelData::canNotEditLastAdmin(gsl::not_null user) const { +bool ChannelData::canNotEditLastAdmin(not_null user) const { if (mgInfo) { auto i = mgInfo->lastAdmins.constFind(user); if (i != mgInfo->lastAdmins.cend()) { @@ -926,7 +926,7 @@ bool ChannelData::canNotEditLastAdmin(gsl::not_null user) const { return false; } -bool ChannelData::canEditAdmin(gsl::not_null user) const { +bool ChannelData::canEditAdmin(not_null user) const { if (user->isSelf()) { return false; } else if (amCreator()) { @@ -937,7 +937,7 @@ bool ChannelData::canEditAdmin(gsl::not_null user) const { return adminRights().is_add_admins(); } -bool ChannelData::canRestrictUser(gsl::not_null user) const { +bool ChannelData::canRestrictUser(not_null user) const { if (user->isSelf()) { return false; } else if (amCreator()) { diff --git a/Telegram/SourceFiles/structs.h b/Telegram/SourceFiles/structs.h index c2f3b88897..e12bb504b5 100644 --- a/Telegram/SourceFiles/structs.h +++ b/Telegram/SourceFiles/structs.h @@ -271,15 +271,15 @@ class PeerData; class PeerClickHandler : public ClickHandler { public: - PeerClickHandler(gsl::not_null peer); + PeerClickHandler(not_null peer); void onClick(Qt::MouseButton button) const override; - gsl::not_null peer() const { + not_null peer() const { return _peer; } private: - gsl::not_null _peer; + not_null _peer; }; @@ -640,11 +640,11 @@ public: bool isMigrated() const { return flags & MTPDchat::Flag::f_migrated_to; } - QMap, int> participants; - OrderedSet> invitedByMe; - OrderedSet> admins; - QList> lastAuthors; - OrderedSet> markupSenders; + QMap, int> participants; + OrderedSet> invitedByMe; + OrderedSet> admins; + QList> lastAuthors; + OrderedSet> markupSenders; int botStatus = 0; // -1 - no bots, 0 - unknown, 1 - one bot, that sees all history, 2 - other // ImagePtr photoFull; @@ -738,11 +738,11 @@ struct MegagroupInfo { } MTPChannelBannedRights rights; }; - QList> lastParticipants; - QMap, Admin> lastAdmins; - QMap, Restricted> lastRestricted; - OrderedSet> markupSenders; - OrderedSet> bots; + QList> lastParticipants; + QMap, Admin> lastAdmins; + QMap, Restricted> lastRestricted; + OrderedSet> markupSenders; + OrderedSet> bots; UserData *creator = nullptr; // nullptr means unknown int botStatus = 0; // -1 - no bots, 0 - unknown, 1 - one bot, that sees all history, 2 - other @@ -826,8 +826,8 @@ public: static bool IsRestrictedForever(TimeId until) { return !until || (until == kRestrictUntilForever); } - void applyEditAdmin(gsl::not_null user, const MTPChannelAdminRights &oldRights, const MTPChannelAdminRights &newRights); - void applyEditBanned(gsl::not_null user, const MTPChannelBannedRights &oldRights, const MTPChannelBannedRights &newRights); + void applyEditAdmin(not_null user, const MTPChannelAdminRights &oldRights, const MTPChannelAdminRights &newRights); + void applyEditBanned(not_null user, const MTPChannelBannedRights &oldRights, const MTPChannelBannedRights &newRights); int32 date = 0; int version = 0; @@ -929,8 +929,8 @@ public: constexpr auto kDeleteChannelMembersLimit = 1000; return amCreator() && (membersCount() <= kDeleteChannelMembersLimit); } - bool canEditAdmin(gsl::not_null user) const; - bool canRestrictUser(gsl::not_null user) const; + bool canEditAdmin(not_null user) const; + bool canRestrictUser(not_null user) const; void setInviteLink(const QString &newInviteLink); QString inviteLink() const { @@ -986,7 +986,7 @@ public: void setRestrictionReason(const QString &reason); private: - bool canNotEditLastAdmin(gsl::not_null user) const; + bool canNotEditLastAdmin(not_null user) const; PtsWaiter _ptsWaiter; @@ -1143,9 +1143,9 @@ private: class PhotoClickHandler : public LeftButtonClickHandler { public: - PhotoClickHandler(gsl::not_null photo, PeerData *peer = nullptr) : _photo(photo), _peer(peer) { + PhotoClickHandler(not_null photo, PeerData *peer = nullptr) : _photo(photo), _peer(peer) { } - gsl::not_null photo() const { + not_null photo() const { return _photo; } PeerData *peer() const { @@ -1153,7 +1153,7 @@ public: } private: - gsl::not_null _photo; + not_null _photo; PeerData *_peer; }; diff --git a/Telegram/SourceFiles/ui/widgets/checkbox.h b/Telegram/SourceFiles/ui/widgets/checkbox.h index 442803d7cf..399701aa23 100644 --- a/Telegram/SourceFiles/ui/widgets/checkbox.h +++ b/Telegram/SourceFiles/ui/widgets/checkbox.h @@ -75,7 +75,7 @@ public: private: QSize rippleSize() const; - gsl::not_null _st; + not_null _st; }; @@ -93,7 +93,7 @@ public: private: QSize rippleSize() const; - gsl::not_null _st; + not_null _st; }; @@ -112,7 +112,7 @@ private: void paintXV(Painter &p, int left, int top, int outerWidth, float64 toggled, const QBrush &brush); QSize rippleSize() const; - gsl::not_null _st; + not_null _st; }; diff --git a/Telegram/SourceFiles/window/section_memento.h b/Telegram/SourceFiles/window/section_memento.h index 9151fa49f8..839b0bceba 100644 --- a/Telegram/SourceFiles/window/section_memento.h +++ b/Telegram/SourceFiles/window/section_memento.h @@ -27,7 +27,7 @@ class SectionWidget; class SectionMemento { public: - virtual object_ptr createWidget(QWidget *parent, gsl::not_null controller, const QRect &geometry) = 0; + virtual object_ptr createWidget(QWidget *parent, not_null controller, const QRect &geometry) = 0; virtual ~SectionMemento() { } diff --git a/Telegram/SourceFiles/window/section_widget.cpp b/Telegram/SourceFiles/window/section_widget.cpp index 459eca71db..54e8c03d48 100644 --- a/Telegram/SourceFiles/window/section_widget.cpp +++ b/Telegram/SourceFiles/window/section_widget.cpp @@ -24,7 +24,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org namespace Window { -SectionWidget::SectionWidget(QWidget *parent, gsl::not_null controller) : AbstractSectionWidget(parent, controller) { +SectionWidget::SectionWidget(QWidget *parent, not_null controller) : AbstractSectionWidget(parent, controller) { } void SectionWidget::setGeometryWithTopMoved(const QRect &newGeometry, int topDelta) { diff --git a/Telegram/SourceFiles/window/section_widget.h b/Telegram/SourceFiles/window/section_widget.h index 8cbba8b5e9..480ec69b3f 100644 --- a/Telegram/SourceFiles/window/section_widget.h +++ b/Telegram/SourceFiles/window/section_widget.h @@ -35,7 +35,7 @@ enum class Column { class AbstractSectionWidget : public TWidget, protected base::Subscriber { public: - AbstractSectionWidget(QWidget *parent, gsl::not_null controller) : TWidget(parent), _controller(controller) { + AbstractSectionWidget(QWidget *parent, not_null controller) : TWidget(parent), _controller(controller) { } // Float player interface. @@ -47,12 +47,12 @@ public: } protected: - gsl::not_null controller() const { + not_null controller() const { return _controller; } private: - gsl::not_null _controller; + not_null _controller; }; @@ -70,7 +70,7 @@ struct SectionSlideParams { class SectionWidget : public AbstractSectionWidget { public: - SectionWidget(QWidget *parent, gsl::not_null controller); + SectionWidget(QWidget *parent, not_null controller); virtual PeerData *peerForDialogs() const { return nullptr; @@ -99,7 +99,7 @@ public: // // If this method returns false it is not supposed to modify the memento. // If this method returns true it may modify the memento ("take" heavy items). - virtual bool showInternal(gsl::not_null memento) = 0; + virtual bool showInternal(not_null memento) = 0; // Create a memento of that section to store it in the history stack. // This method may modify the section ("take" heavy items). diff --git a/Telegram/SourceFiles/window/top_bar_widget.cpp b/Telegram/SourceFiles/window/top_bar_widget.cpp index 2cebd8ae0e..2a3863273d 100644 --- a/Telegram/SourceFiles/window/top_bar_widget.cpp +++ b/Telegram/SourceFiles/window/top_bar_widget.cpp @@ -37,7 +37,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org namespace Window { -TopBarWidget::TopBarWidget(QWidget *parent, gsl::not_null controller) : TWidget(parent) +TopBarWidget::TopBarWidget(QWidget *parent, not_null controller) : TWidget(parent) , _controller(controller) , _clearSelection(this, langFactory(lng_selected_clear), st::topBarClearButton) , _forward(this, langFactory(lng_selected_forward), st::defaultActiveButton) diff --git a/Telegram/SourceFiles/window/top_bar_widget.h b/Telegram/SourceFiles/window/top_bar_widget.h index d2ba6fa65f..5f0d64ac6e 100644 --- a/Telegram/SourceFiles/window/top_bar_widget.h +++ b/Telegram/SourceFiles/window/top_bar_widget.h @@ -37,7 +37,7 @@ class TopBarWidget : public TWidget, private base::Subscriber { Q_OBJECT public: - TopBarWidget(QWidget *parent, gsl::not_null controller); + TopBarWidget(QWidget *parent, not_null controller); struct SelectedState { bool textSelected = false; @@ -80,7 +80,7 @@ private: void updateAdaptiveLayout(); int countSelectedButtonsTop(float64 selectedShown); - gsl::not_null _controller; + not_null _controller; PeerData *_searchInPeer = nullptr; int _selectedCount = 0; diff --git a/Telegram/SourceFiles/window/window_controller.cpp b/Telegram/SourceFiles/window/window_controller.cpp index 7dbc42bbde..e495b8d921 100644 --- a/Telegram/SourceFiles/window/window_controller.cpp +++ b/Telegram/SourceFiles/window/window_controller.cpp @@ -136,7 +136,7 @@ void Controller::provideChatWidth(int requestedWidth) { } } -void Controller::showJumpToDate(gsl::not_null peer, QDate requestedDate) { +void Controller::showJumpToDate(not_null peer, QDate requestedDate) { Expects(peer != nullptr); auto currentPeerDate = [peer] { if (auto history = App::historyLoaded(peer)) { diff --git a/Telegram/SourceFiles/window/window_controller.h b/Telegram/SourceFiles/window/window_controller.h index d414503ba6..62587b1176 100644 --- a/Telegram/SourceFiles/window/window_controller.h +++ b/Telegram/SourceFiles/window/window_controller.h @@ -39,10 +39,10 @@ class Controller { public: static constexpr auto kDefaultDialogsWidthRatio = 5. / 14; - Controller(gsl::not_null window) : _window(window) { + Controller(not_null window) : _window(window) { } - gsl::not_null window() const { + not_null window() const { return _window; } @@ -80,7 +80,7 @@ public: bool canProvideChatWidth(int requestedWidth) const; void provideChatWidth(int requestedWidth); - void showJumpToDate(gsl::not_null peer, QDate requestedDate); + void showJumpToDate(not_null peer, QDate requestedDate); base::Variable &dialogsWidthRatio() { return _dialogsWidthRatio; @@ -102,7 +102,7 @@ public: } private: - gsl::not_null _window; + not_null _window; base::Observable _searchInPeerChanged; base::Observable _historyPeerChanged; diff --git a/Telegram/SourceFiles/window/window_main_menu.cpp b/Telegram/SourceFiles/window/window_main_menu.cpp index bc0a35400b..efbdfae716 100644 --- a/Telegram/SourceFiles/window/window_main_menu.cpp +++ b/Telegram/SourceFiles/window/window_main_menu.cpp @@ -96,14 +96,14 @@ void MainMenu::refreshMenu() { App::wnd()->onShowNewChannel(); }, &st::mainMenuNewChannel, &st::mainMenuNewChannelOver); _menu->addAction(lang(lng_menu_contacts), [] { - Ui::show(Box(std::make_unique(), [](gsl::not_null box) { + Ui::show(Box(std::make_unique(), [](not_null box) { box->addButton(langFactory(lng_close), [box] { box->closeBox(); }); box->addLeftButton(langFactory(lng_profile_add_contact), [] { App::wnd()->onShowAddContact(); }); })); }, &st::mainMenuContacts, &st::mainMenuContactsOver); if (Global::PhoneCallsEnabled()) { _menu->addAction(lang(lng_menu_calls), [] { - Ui::show(Box(std::make_unique(), [](gsl::not_null box) { + Ui::show(Box(std::make_unique(), [](not_null box) { box->addButton(langFactory(lng_close), [box] { box->closeBox(); }); })); }, &st::mainMenuCalls, &st::mainMenuCallsOver);