Skip to content

Commit

Permalink
fixed inline results display lag, cancelling inline query by Escape, …
Browse files Browse the repository at this point in the history
…add/erase in overview refactored, animated gifv are not in shared files anymore
  • Loading branch information
john-preston committed Jan 3, 2016
1 parent 12ff884 commit 5a87bf4
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 173 deletions.
7 changes: 5 additions & 2 deletions Telegram/Build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,12 @@ if %BetaVersion% neq 0 (
exit /b 1
)
)

cd SourceFiles\
copy telegram.qrc /B+,,/Y
if "%1" == "fast" (
echo Skipping touching of telegram.qrc..
) else (
copy telegram.qrc /B+,,/Y
)
cd ..\
if %errorlevel% neq 0 goto error

Expand Down
44 changes: 19 additions & 25 deletions Telegram/SourceFiles/app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ namespace App {

ChannelData *cdata = data->asChannel();
cdata->inputChannel = MTP_inputChannel(d.vid, d.vaccess_hash);

QString uname = d.has_username() ? textOneLine(qs(d.vusername)) : QString();
cdata->setName(qs(d.vtitle), uname);

Expand Down Expand Up @@ -901,18 +901,12 @@ namespace App {
peerId = peerFromUser(m.vfrom_id);
}
if (HistoryItem *existing = App::histItemById(peerToChannel(peerId), m.vid.v)) {
bool hasLinks = m.has_entities() && !m.ventities.c_vector().v.isEmpty();
if ((hasLinks && !existing->hasTextLinks()) || (!hasLinks && existing->textHasLinks())) {
existing->setText(qs(m.vmessage), m.has_entities() ? entitiesFromMTP(m.ventities.c_vector().v) : EntitiesInText());
existing->initDimensions();
Notify::historyItemResized(existing);
if (existing->hasTextLinks() && existing->indexInOverview()) {
existing->history()->addToOverview(existing, OverviewLinks);
}
}
existing->setText(qs(m.vmessage), m.has_entities() ? entitiesFromMTP(m.ventities.c_vector().v) : EntitiesInText());
existing->initDimensions();
Notify::historyItemResized(existing);

existing->updateMedia(m.has_media() ? (&m.vmedia) : 0, true);

existing->addToOverview(AddToOverviewNew);
existing->setViewsCount(m.has_views() ? m.vviews.v : -1);

if (!existing->detached()) {
Expand Down Expand Up @@ -1001,7 +995,7 @@ namespace App {
const string &s(d.vbytes.c_string().v);
QByteArray bytes(s.data(), s.size());
return ImagePtr(StorageImageLocation(d.vw.v, d.vh.v, 0, 0, 0, 0), bytes);
}
}
} break;
}
return ImagePtr();
Expand All @@ -1028,7 +1022,7 @@ namespace App {
}
return StorageImageLocation();
}

void feedInboxRead(const PeerId &peer, MsgId upTo) {
History *h = App::historyLoaded(peer);
if (h) {
Expand Down Expand Up @@ -1250,7 +1244,7 @@ namespace App {
const string &s(i->c_photoSize().vtype.c_string().v);
if (s.size()) size = s[0];
} break;

case mtpc_photoCachedSize: {
const string &s(i->c_photoCachedSize().vtype.c_string().v);
if (s.size()) size = s[0];
Expand Down Expand Up @@ -1291,7 +1285,7 @@ namespace App {
}
return App::photoSet(photo.vid.v, convert, 0, 0, ImagePtr(), ImagePtr(), ImagePtr());
}

VideoData *feedVideo(const MTPDvideo &video, VideoData *convert) {
return App::videoSet(video.vid.v, convert, video.vaccess_hash.v, video.vdate.v, video.vduration.v, video.vw.v, video.vh.v, App::image(video.vthumb), video.vdc_id.v, video.vsize.v);
}
Expand Down Expand Up @@ -1767,15 +1761,15 @@ namespace App {
}
return result;
}

ImageLinkData *imageLink(const QString &imageLink) {
ImageLinksData::const_iterator i = imageLinksData.constFind(imageLink);
if (i == imageLinksData.cend()) {
i = imageLinksData.insert(imageLink, new ImageLinkData(imageLink));
}
return i.value();
}

ImageLinkData *imageLinkSet(const QString &imageLink, ImageLinkType type, const QString &url) {
ImageLinksData::const_iterator i = imageLinksData.constFind(imageLink);
ImageLinkData *result;
Expand Down Expand Up @@ -1812,7 +1806,7 @@ namespace App {
MTPPhoto photoFromUserPhoto(MTPint userId, MTPint date, const MTPUserProfilePhoto &photo) {
if (photo.type() == mtpc_userProfilePhoto) {
const MTPDuserProfilePhoto &uphoto(photo.c_userProfilePhoto());

QVector<MTPPhotoSize> photoSizes;
photoSizes.push_back(MTP_photoSize(MTP_string("a"), uphoto.vphoto_small, MTP_int(160), MTP_int(160), MTP_int(0)));
photoSizes.push_back(MTP_photoSize(MTP_string("c"), uphoto.vphoto_big, MTP_int(640), MTP_int(640), MTP_int(0)));
Expand All @@ -1837,7 +1831,7 @@ namespace App {
History *historyFromDialog(const PeerId &peer, int32 unreadCnt, int32 maxInboxRead) {
return ::histories.findOrInsert(peer, unreadCnt, maxInboxRead);
}

History *historyLoaded(const PeerId &peer) {
return ::histories.find(peer);
}
Expand Down Expand Up @@ -2136,13 +2130,13 @@ namespace App {
prepareCorners(MessageOutCorners, st::msgRadius, st::msgOutBg, &st::msgOutShadow);
prepareCorners(MessageOutSelectedCorners, st::msgRadius, st::msgOutBgSelected, &st::msgOutShadowSelected);
}

void clearHistories() {
textlnkOver(TextLinkPtr());
textlnkDown(TextLinkPtr());

histories().clear();

clearStorageImages();
cSetServerBackgrounds(WallPapers());

Expand Down Expand Up @@ -2191,7 +2185,7 @@ namespace App {
HistoryItem *pressedItem() {
return ::pressedItem;
}

void hoveredLinkItem(HistoryItem *item) {
::hoveredLinkItem = item;
}
Expand All @@ -2207,7 +2201,7 @@ namespace App {
HistoryItem *pressedLinkItem() {
return ::pressedLinkItem;
}

void contextItem(HistoryItem *item) {
::contextItem = item;
}
Expand Down Expand Up @@ -2539,7 +2533,7 @@ namespace App {
case mtpc_replyKeyboardMarkup: {
const MTPDreplyKeyboardMarkup &d(markup.c_replyKeyboardMarkup());
data.flags = d.vflags.v;

const QVector<MTPKeyboardButtonRow> &v(d.vrows.c_vector().v);
if (!v.isEmpty()) {
commands.reserve(v.size());
Expand Down Expand Up @@ -2630,7 +2624,7 @@ namespace App {
} else {
socket.setProxy(QNetworkProxy(QNetworkProxy::NoProxy));
}
}
}

QImage **cornersMask() {
return ::cornersMask;
Expand Down
9 changes: 6 additions & 3 deletions Telegram/SourceFiles/dropdown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2769,7 +2769,7 @@ void EmojiPan::paintEvent(QPaintEvent *e) {
if (_cache.isNull()) {
p.fillRect(myrtlrect(r.x() + r.width() - st::emojiScroll.width, r.y(), st::emojiScroll.width, e_scroll.height()), st::white->b);
if (_stickersShown && s_inner.showSectionIcons()) {
p.fillRect(r.left(), _iconsTop, r.width(), st::rbEmoji.height, st::emojiPanCategories->b);
p.fillRect(r.left(), _iconsTop, r.width(), st::rbEmoji.height, st::emojiPanCategories);
p.drawSpriteLeft(_iconsLeft + 7 * st::rbEmoji.width + st::rbEmojiRecent.imagePos.x(), _iconsTop + st::rbEmojiRecent.imagePos.y(), width(), st::stickersSettings);

if (!_icons.isEmpty()) {
Expand Down Expand Up @@ -2818,10 +2818,13 @@ void EmojiPan::paintEvent(QPaintEvent *e) {
p.drawSpriteRight(QRect(width() - _iconsLeft - 7 * st::rbEmoji.width, _iconsTop, st::stickerIconRight.pxWidth(), st::rbEmoji.height), width(), st::stickerIconRight);
}
}
} else if (_stickersShown) {
int32 x = rtl() ? (_recent.x() + _recent.width()) : (_objects.x() + _objects.width());
p.fillRect(x, _recent.y(), r.left() + r.width() - x, st::rbEmoji.height, st::white);
} else {
p.fillRect(r.left(), _recent.y(), (rtl() ? _objects.x() : _recent.x() - r.left()), st::rbEmoji.height, st::emojiPanCategories->b);
p.fillRect(r.left(), _recent.y(), (rtl() ? _objects.x() : _recent.x() - r.left()), st::rbEmoji.height, st::emojiPanCategories);
int32 x = rtl() ? (_recent.x() + _recent.width()) : (_objects.x() + _objects.width());
p.fillRect(x, _recent.y(), r.left() + r.width() - x, st::rbEmoji.height, st::emojiPanCategories->b);
p.fillRect(x, _recent.y(), r.left() + r.width() - x, st::rbEmoji.height, st::emojiPanCategories);
}
} else {
p.fillRect(r, st::white->b);
Expand Down
3 changes: 3 additions & 0 deletions Telegram/SourceFiles/dropdown.h
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,9 @@ class EmojiPan : public TWidget, public RPCSender {
bool ui_isInlineItemVisible(const LayoutInlineItem *layout);
bool ui_isInlineItemBeingChosen();

bool inlineResultsShown() const {
return s_inner.inlineResultsShown();
}
void notify_automaticLoadSettingsChangedGif();

public slots:
Expand Down
Loading

0 comments on commit 5a87bf4

Please sign in to comment.