2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 22:46:10 +00:00

Remove main()->peerUpdated and some other signals.

This commit is contained in:
John Preston
2017-08-11 12:42:52 +02:00
parent 8e433971c9
commit e13ed9b909
19 changed files with 161 additions and 247 deletions

View File

@@ -84,8 +84,6 @@ DialogsInner::DialogsInner(QWidget *parent, gsl::not_null<Window::Controller*> c
_dialogsImportant = std::make_unique<Dialogs::IndexedList>(Dialogs::SortMode::Date);
_importantSwitch = std::make_unique<ImportantSwitch>();
}
connect(main, SIGNAL(peerNameChanged(PeerData*, const PeerData::Names&, const PeerData::NameFirstChars&)), this, SLOT(onPeerNameChanged(PeerData*, const PeerData::Names&, const PeerData::NameFirstChars&)));
connect(main, SIGNAL(peerPhotoChanged(PeerData*)), this, SLOT(onPeerPhotoChanged(PeerData*)));
connect(main, SIGNAL(dialogRowReplaced(Dialogs::Row*, Dialogs::Row*)), this, SLOT(onDialogRowReplaced(Dialogs::Row*, Dialogs::Row*)));
connect(_addContactLnk, SIGNAL(clicked()), App::wnd(), SLOT(onShowAddContact()));
_cancelSearchInPeer->setClickedCallback([this] { cancelSearchInPeer(); });
@@ -108,8 +106,21 @@ DialogsInner::DialogsInner(QWidget *parent, gsl::not_null<Window::Controller*> c
}
});
subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(Notify::PeerUpdate::Flag::PinnedChanged, [this](const Notify::PeerUpdate &update) {
stopReorderPinned();
using UpdateFlag = Notify::PeerUpdate::Flag;
auto changes = UpdateFlag::PinnedChanged
| UpdateFlag::NameChanged
| UpdateFlag::PhotoChanged;
subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(changes, [this](const Notify::PeerUpdate &update) {
if (update.flags & UpdateFlag::PinnedChanged) {
stopReorderPinned();
}
if (update.flags & UpdateFlag::NameChanged) {
handlePeerNameChange(update.peer, update.oldNames, update.oldNameFirstChars);
}
if (update.flags & UpdateFlag::PhotoChanged) {
this->update();
emit App::main()->dialogsUpdated();
}
}));
refresh();
@@ -1253,7 +1264,7 @@ void DialogsInner::onParentGeometryChanged() {
}
}
void DialogsInner::onPeerNameChanged(PeerData *peer, const PeerData::Names &oldNames, const PeerData::NameFirstChars &oldChars) {
void DialogsInner::handlePeerNameChange(gsl::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);
@@ -1263,10 +1274,6 @@ void DialogsInner::onPeerNameChanged(PeerData *peer, const PeerData::Names &oldN
update();
}
void DialogsInner::onPeerPhotoChanged(PeerData *peer) {
update();
}
void DialogsInner::onFilterUpdate(QString newFilter, bool force) {
auto words = TextUtilities::PrepareSearchWords(newFilter);
newFilter = words.isEmpty() ? QString() : words.join(' ');