2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-02 07:35:12 +00:00

ITextLink moved to ClickHandler, TextLinkPtr > ClickHandlerPtr.

Global methods textlnkOver/Down/DrawOver were replaced by
static members of ClickHandler, now global state consists
of the handler pointer + host pointer, who declares callbacks
for the active and pressed handler changed events.

This will allow to use ClickHandler from different hosts
simultaneously (like HistoryItem / BotDescription / BotKeyboard).

Not yet tested.
This commit is contained in:
John Preston
2016-03-29 20:17:00 +03:00
parent 2c6f74f923
commit 7f6cf32cdd
40 changed files with 1976 additions and 1446 deletions

View File

@@ -215,7 +215,9 @@ SettingsInner::SettingsInner(SettingsWidget *parent) : TWidget(parent)
_nameText.setText(st::setNameFont, _nameCache, _textNameOptions);
PhotoData *selfPhoto = (self()->photoId && self()->photoId != UnknownPeerPhotoId) ? App::photo(self()->photoId) : 0;
if (selfPhoto && selfPhoto->date) _photoLink = TextLinkPtr(new PhotoLink(selfPhoto, self()));
if (selfPhoto && selfPhoto->date) {
_photoLink.reset(new PhotoOpenClickHandler(selfPhoto, self()));
}
App::api()->requestFullPeer(self());
onReloadPassword();
@@ -354,13 +356,13 @@ void SettingsInner::peerUpdated(PeerData *data) {
if (self()->photoId && self()->photoId != UnknownPeerPhotoId) {
PhotoData *selfPhoto = App::photo(self()->photoId);
if (selfPhoto->date) {
_photoLink = TextLinkPtr(new PhotoLink(selfPhoto, self()));
_photoLink.reset(new PhotoOpenClickHandler(selfPhoto, self()));
} else {
_photoLink = TextLinkPtr();
_photoLink.clear();
App::api()->requestFullPeer(self());
}
} else {
_photoLink = TextLinkPtr();
_photoLink.clear();
}
if (_nameCache != self()->name) {
@@ -940,9 +942,9 @@ void SettingsInner::onFullPeerUpdated(PeerData *peer) {
PhotoData *selfPhoto = (self()->photoId && self()->photoId != UnknownPeerPhotoId) ? App::photo(self()->photoId) : 0;
if (selfPhoto && selfPhoto->date) {
_photoLink = TextLinkPtr(new PhotoLink(selfPhoto, self()));
_photoLink.reset(new PhotoOpenClickHandler(selfPhoto, self()));
} else {
_photoLink = TextLinkPtr();
_photoLink.clear();
}
}