2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Replace gsl::not_null<T*> with just not_null<T*>.

This commit is contained in:
John Preston
2017-08-17 11:31:24 +03:00
parent cc4023d26a
commit b3da99c302
148 changed files with 966 additions and 963 deletions

View File

@@ -65,7 +65,7 @@ struct DialogsInner::PeerSearchResult {
Dialogs::RippleRow row;
};
DialogsInner::DialogsInner(QWidget *parent, gsl::not_null<Window::Controller*> controller, QWidget *main) : SplittedWidget(parent)
DialogsInner::DialogsInner(QWidget *parent, not_null<Window::Controller*> controller, QWidget *main) : SplittedWidget(parent)
, _controller(controller)
, _dialogs(std::make_unique<Dialogs::IndexedList>(Dialogs::SortMode::Date))
, _contactsNoDialogs(std::make_unique<Dialogs::IndexedList>(Dialogs::SortMode::Name))
@@ -464,7 +464,7 @@ void DialogsInner::paintSearchInPeer(Painter &p, int fullWidth, bool onlyBackgro
}
}
void DialogsInner::paintSearchInFilter(Painter &p, gsl::not_null<PeerData*> peer, int top, int fullWidth, const Text &text) const {
void DialogsInner::paintSearchInFilter(Painter &p, not_null<PeerData*> peer, int top, int fullWidth, const Text &text) const {
auto pen = p.pen();
peer->paintUserpicLeft(p, st::dialogsPadding.x(), top + (st::dialogsSearchInHeight - st::dialogsSearchInPhotoSize) / 2, getFullWidth(), st::dialogsSearchInPhotoSize);
@@ -1264,7 +1264,7 @@ void DialogsInner::onParentGeometryChanged() {
}
}
void DialogsInner::handlePeerNameChange(gsl::not_null<PeerData*> peer, const PeerData::Names &oldNames, const PeerData::NameFirstChars &oldChars) {
void DialogsInner::handlePeerNameChange(not_null<PeerData*> peer, const PeerData::Names &oldNames, const PeerData::NameFirstChars &oldChars) {
_dialogs->peerNameChanged(Dialogs::Mode::All, peer, oldNames, oldChars);
if (_dialogsImportant) {
_dialogsImportant->peerNameChanged(Dialogs::Mode::Important, peer, oldNames, oldChars);

View File

@@ -42,7 +42,7 @@ class DialogsInner : public Ui::SplittedWidget, public RPCSender, private base::
Q_OBJECT
public:
DialogsInner(QWidget *parent, gsl::not_null<Window::Controller*> controller, QWidget *main);
DialogsInner(QWidget *parent, not_null<Window::Controller*> controller, QWidget *main);
void dialogsReceived(const QVector<MTPDialog> &dialogs);
void 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<PeerData*> peer, const PeerData::Names &oldNames, const PeerData::NameFirstChars &oldChars);
void handlePeerNameChange(not_null<PeerData*> peer, const PeerData::Names &oldNames, const PeerData::NameFirstChars &oldChars);
void itemRemoved(HistoryItem *item);
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<PeerData*> peer, int top, int fullWidth, const Text &text) const;
void paintSearchInFilter(Painter &p, not_null<PeerData*> peer, int top, int fullWidth, const Text &text) const;
void clearSelection();
void clearSearchResults(bool clearPeerSearchResults = true);
@@ -213,7 +213,7 @@ private:
void savePinnedOrder();
void step_pinnedShifting(TimeMs ms, bool timer);
gsl::not_null<Window::Controller*> _controller;
not_null<Window::Controller*> _controller;
DialogsList _dialogs;
DialogsList _dialogsImportant;

View File

@@ -27,7 +27,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
namespace Dialogs {
void ShowSearchFromBox(PeerData *peer, base::lambda<void(gsl::not_null<UserData*>)> callback, base::lambda<void()> closedCallback) {
void ShowSearchFromBox(PeerData *peer, base::lambda<void(not_null<UserData*>)> callback, base::lambda<void()> closedCallback) {
auto createController = [peer, callback = std::move(callback)]() -> std::unique_ptr<PeerListController> {
if (peer) {
if (auto chat = peer->asChat()) {
@@ -40,14 +40,14 @@ void ShowSearchFromBox(PeerData *peer, base::lambda<void(gsl::not_null<UserData*
};
if (auto controller = createController()) {
auto subscription = std::make_shared<base::Subscription>();
auto box = Ui::show(Box<PeerListBox>(std::move(controller), [subscription](gsl::not_null<PeerListBox*> box) {
auto box = Ui::show(Box<PeerListBox>(std::move(controller), [subscription](not_null<PeerListBox*> box) {
box->addButton(langFactory(lng_cancel), [box, subscription] { box->closeBox(); });
}), KeepOtherLayers);
*subscription = box->boxClosing.add_subscription(std::move(closedCallback));
}
}
ChatSearchFromController::ChatSearchFromController(gsl::not_null<ChatData*> chat, base::lambda<void(gsl::not_null<UserData*>)> callback) : PeerListController()
ChatSearchFromController::ChatSearchFromController(not_null<ChatData*> chat, base::lambda<void(not_null<UserData*>)> callback) : PeerListController()
, _chat(chat)
, _callback(std::move(callback)) {
}
@@ -66,7 +66,7 @@ void ChatSearchFromController::prepare() {
}));
}
void ChatSearchFromController::rowClicked(gsl::not_null<PeerListRow*> row) {
void ChatSearchFromController::rowClicked(not_null<PeerListRow*> row) {
Expects(row->peer()->isUser());
_callback(row->peer()->asUser());
}
@@ -109,13 +109,13 @@ void ChatSearchFromController::checkForEmptyRows() {
}
}
void ChatSearchFromController::appendRow(gsl::not_null<UserData*> user) {
void ChatSearchFromController::appendRow(not_null<UserData*> user) {
if (!delegate()->peerListFindRow(user->id)) {
delegate()->peerListAppendRow(std::make_unique<PeerListRow>(user));
}
}
ChannelSearchFromController::ChannelSearchFromController(gsl::not_null<ChannelData*> channel, base::lambda<void(gsl::not_null<UserData*>)> callback) : ParticipantsBoxController(channel, ParticipantsBoxController::Role::Members)
ChannelSearchFromController::ChannelSearchFromController(not_null<ChannelData*> channel, base::lambda<void(not_null<UserData*>)> callback) : ParticipantsBoxController(channel, ParticipantsBoxController::Role::Members)
, _callback(std::move(callback)) {
}
@@ -124,12 +124,12 @@ void ChannelSearchFromController::prepare() {
delegate()->peerListSetTitle(langFactory(lng_search_messages_from));
}
void ChannelSearchFromController::rowClicked(gsl::not_null<PeerListRow*> row) {
void ChannelSearchFromController::rowClicked(not_null<PeerListRow*> row) {
Expects(row->peer()->isUser());
_callback(row->peer()->asUser());
}
std::unique_ptr<PeerListRow> ChannelSearchFromController::createRow(gsl::not_null<UserData*> user) const {
std::unique_ptr<PeerListRow> ChannelSearchFromController::createRow(not_null<UserData*> user) const {
return std::make_unique<PeerListRow>(user);
}

View File

@@ -25,37 +25,37 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
namespace Dialogs {
void ShowSearchFromBox(PeerData *peer, base::lambda<void(gsl::not_null<UserData*>)> callback, base::lambda<void()> closedCallback);
void ShowSearchFromBox(PeerData *peer, base::lambda<void(not_null<UserData*>)> callback, base::lambda<void()> closedCallback);
class ChatSearchFromController : public PeerListController, protected base::Subscriber {
public:
ChatSearchFromController(gsl::not_null<ChatData*> chat, base::lambda<void(gsl::not_null<UserData*>)> callback);
ChatSearchFromController(not_null<ChatData*> chat, base::lambda<void(not_null<UserData*>)> callback);
void prepare() override;
void rowClicked(gsl::not_null<PeerListRow*> row) override;
void rowClicked(not_null<PeerListRow*> row) override;
private:
void rebuildRows();
void checkForEmptyRows();
void appendRow(gsl::not_null<UserData*> user);
void appendRow(not_null<UserData*> user);
gsl::not_null<ChatData*> _chat;
base::lambda<void(gsl::not_null<UserData*>)> _callback;
not_null<ChatData*> _chat;
base::lambda<void(not_null<UserData*>)> _callback;
};
class ChannelSearchFromController : public Profile::ParticipantsBoxController {
public:
ChannelSearchFromController(gsl::not_null<ChannelData*> channel, base::lambda<void(gsl::not_null<UserData*>)> callback);
ChannelSearchFromController(not_null<ChannelData*> channel, base::lambda<void(not_null<UserData*>)> callback);
void prepare() override;
void rowClicked(gsl::not_null<PeerListRow*> row) override;
void rowClicked(not_null<PeerListRow*> row) override;
protected:
std::unique_ptr<PeerListRow> createRow(gsl::not_null<UserData*> user) const override;
std::unique_ptr<PeerListRow> createRow(not_null<UserData*> user) const override;
private:
base::lambda<void(gsl::not_null<UserData*>)> _callback;
base::lambda<void(not_null<UserData*>)> _callback;
};

View File

@@ -91,7 +91,7 @@ void DialogsWidget::UpdateButton::paintEvent(QPaintEvent *e) {
}
}
DialogsWidget::DialogsWidget(QWidget *parent, gsl::not_null<Window::Controller*> controller) : Window::AbstractSectionWidget(parent, controller)
DialogsWidget::DialogsWidget(QWidget *parent, not_null<Window::Controller*> controller) : Window::AbstractSectionWidget(parent, controller)
, _mainMenuToggle(this, st::dialogsMenuToggle)
, _filter(this, st::dialogsFilter, langFactory(lng_dlg_filter))
, _chooseFromUser(this, object_ptr<Ui::IconButton>(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<UserData*> user) {
Dialogs::ShowSearchFromBox(peer, base::lambda_guarded(this, [this, peer](not_null<UserData*> user) {
Ui::hideLayer();
setSearchInPeer(peer, user);
onFilterUpdate(true);

View File

@@ -59,7 +59,7 @@ class DialogsWidget : public Window::AbstractSectionWidget, public RPCSender {
Q_OBJECT
public:
DialogsWidget(QWidget *parent, gsl::not_null<Window::Controller*> controller);
DialogsWidget(QWidget *parent, not_null<Window::Controller*> controller);
void updateDragInScroll(bool inScroll);