Beta 10008004: games / webpages work fine if media autoload disabled.

Also moved alot of file icons from sprite to separate b&w files.
This commit is contained in:
John Preston 2016-09-29 22:42:14 +03:00
parent 1247bd19b6
commit a5eee9bd3e
28 changed files with 249 additions and 170 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 234 KiB

After

Width:  |  Height:  |  Size: 109 KiB

View File

@ -1169,30 +1169,78 @@ msgFileOutBg: #78c67f;
msgFileOutBgOver: #6bc272; msgFileOutBgOver: #6bc272;
msgFileOutBgSelected: #5fb389; msgFileOutBgSelected: #5fb389;
msgFileOutImage: sprite(0px, 146px, 18px, 18px); msgFileOutImage: icon {
msgFileOutImageSelected: sprite(18px, 146px, 18px, 18px); { "msg_file_image", msgOutBg },
msgFileInImage: sprite(0px, 164px, 18px, 18px); };
msgFileInImageSelected: sprite(18px, 164px, 18px, 18px); msgFileOutImageSelected: icon {
msgFileOutFile: sprite(36px, 146px, 18px, 18px); { "msg_file_image", msgOutBgSelected },
msgFileOutFileSelected: sprite(54px, 146px, 18px, 18px); };
msgFileInFile: sprite(36px, 164px, 18px, 18px); msgFileInImage: icon {
msgFileInFileSelected: sprite(54px, 164px, 18px, 18px); { "msg_file_image", msgInBg },
msgFileOutDownload: sprite(72px, 142px, 14px, 20px); };
msgFileOutDownloadSelected: sprite(86px, 142px, 14px, 20px); msgFileInImageSelected: icon {
msgFileInDownload: sprite(72px, 162px, 14px, 20px); { "msg_file_image", msgInBgSelected },
msgFileInDownloadSelected: sprite(86px, 162px, 14px, 20px); };
msgFileOutCancel: sprite(100px, 147px, 16px, 16px); msgFileOutDocument: icon {
msgFileOutCancelSelected: sprite(116px, 147px, 16px, 16px); { "msg_file_document", msgOutBg },
msgFileInCancel: sprite(100px, 165px, 16px, 16px); };
msgFileInCancelSelected: sprite(116px, 165px, 16px, 16px); msgFileOutDocumentSelected: icon {
msgFileOutPause: sprite(132px, 147px, 14px, 16px); { "msg_file_document", msgOutBgSelected },
msgFileOutPauseSelected: sprite(146px, 147px, 14px, 16px); };
msgFileInPause: sprite(132px, 165px, 14px, 16px); msgFileInDocument: icon {
msgFileInPauseSelected: sprite(146px, 165px, 14px, 16px); { "msg_file_document", msgInBg },
msgFileOutPlay: sprite(160px, 146px, 20px, 18px); };
msgFileOutPlaySelected: sprite(180px, 146px, 20px, 18px); msgFileInDocumentSelected: icon {
msgFileInPlay: sprite(160px, 164px, 20px, 18px); { "msg_file_document", msgInBgSelected },
msgFileInPlaySelected: sprite(180px, 164px, 20px, 18px); };
msgFileOutDownload: icon {
{ "msg_file_download", msgOutBg },
};
msgFileOutDownloadSelected: icon {
{ "msg_file_download", msgOutBgSelected },
};
msgFileInDownload: icon {
{ "msg_file_download", msgInBg },
};
msgFileInDownloadSelected: icon {
{ "msg_file_download", msgInBgSelected },
};
msgFileOutCancel: icon {
{ "msg_file_cancel", msgOutBg },
};
msgFileOutCancelSelected: icon {
{ "msg_file_cancel", msgOutBgSelected },
};
msgFileInCancel: icon {
{ "msg_file_cancel", msgInBg },
};
msgFileInCancelSelected: icon {
{ "msg_file_cancel", msgInBgSelected },
};
msgFileOutPause: icon {
{ "msg_file_pause", msgOutBg },
};
msgFileOutPauseSelected: icon {
{ "msg_file_pause", msgOutBgSelected },
};
msgFileInPause: icon {
{ "msg_file_pause", msgInBg },
};
msgFileInPauseSelected: icon {
{ "msg_file_pause", msgInBgSelected },
};
msgFileOutPlay: icon {
{ "msg_file_play", msgOutBg },
};
msgFileOutPlaySelected: icon {
{ "msg_file_play", msgOutBgSelected },
};
msgFileInPlay: icon {
{ "msg_file_play", msgInBg },
};
msgFileInPlaySelected: icon {
{ "msg_file_play", msgInBgSelected },
};
msgFileRed: sprite(0px, 425px, 20px, 20px); msgFileRed: sprite(0px, 425px, 20px, 20px);
msgFileYellow: sprite(20px, 425px, 20px, 20px); msgFileYellow: sprite(20px, 425px, 20px, 20px);

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 B

View File

@ -34,8 +34,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,10,8,3 FILEVERSION 0,10,8,4
PRODUCTVERSION 0,10,8,3 PRODUCTVERSION 0,10,8,4
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -51,10 +51,10 @@ BEGIN
BLOCK "040904b0" BLOCK "040904b0"
BEGIN BEGIN
VALUE "CompanyName", "Telegram Messenger LLP" VALUE "CompanyName", "Telegram Messenger LLP"
VALUE "FileVersion", "0.10.8.3" VALUE "FileVersion", "0.10.8.4"
VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "LegalCopyright", "Copyright (C) 2014-2016"
VALUE "ProductName", "Telegram Desktop" VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "0.10.8.3" VALUE "ProductVersion", "0.10.8.4"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,10,8,3 FILEVERSION 0,10,8,4
PRODUCTVERSION 0,10,8,3 PRODUCTVERSION 0,10,8,4
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@ -43,10 +43,10 @@ BEGIN
BEGIN BEGIN
VALUE "CompanyName", "Telegram Messenger LLP" VALUE "CompanyName", "Telegram Messenger LLP"
VALUE "FileDescription", "Telegram Updater" VALUE "FileDescription", "Telegram Updater"
VALUE "FileVersion", "0.10.8.3" VALUE "FileVersion", "0.10.8.4"
VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "LegalCopyright", "Copyright (C) 2014-2016"
VALUE "ProductName", "Telegram Desktop" VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "0.10.8.3" VALUE "ProductVersion", "0.10.8.4"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View File

@ -233,7 +233,8 @@ void PhotoSendBox::paintEvent(QPaintEvent *e) {
p.drawEllipse(inner); p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.setRenderHint(QPainter::HighQualityAntialiasing, false);
p.drawSpriteCenter(inner, st::msgFileInPlay); auto icon = &st::msgFileInPlay;
icon->paintInCenter(p, inner);
} }
} else { } else {
int32 w = width() - st::boxPhotoPadding.left() - st::boxPhotoPadding.right(); int32 w = width() - st::boxPhotoPadding.left() - st::boxPhotoPadding.right();
@ -272,7 +273,8 @@ void PhotoSendBox::paintEvent(QPaintEvent *e) {
p.drawEllipse(inner); p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.setRenderHint(QPainter::HighQualityAntialiasing, false);
p.drawSpriteCenter(inner, _isImage ? st::msgFileOutImage : st::msgFileOutFile); auto icon = &(_isImage ? st::msgFileOutImage : st::msgFileOutDocument);
icon->paintInCenter(p, inner);
} else { } else {
p.drawPixmapLeft(x + st::msgFilePadding.left(), y + st::msgFilePadding.top(), width(), userDefPhoto(1)->pixCircled(st::msgFileSize)); p.drawPixmapLeft(x + st::msgFilePadding.left(), y + st::msgFilePadding.top(), width(), userDefPhoto(1)->pixCircled(st::msgFileSize));
} }
@ -553,7 +555,8 @@ void EditCaptionBox::paintEvent(QPaintEvent *e) {
p.drawEllipse(inner); p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.setRenderHint(QPainter::HighQualityAntialiasing, false);
p.drawSpriteCenter(inner, st::msgFileInPlay); auto icon = &st::msgFileInPlay;
icon->paintInCenter(p, inner);
} }
} else if (_doc) { } else if (_doc) {
int32 w = width() - st::boxPhotoPadding.left() - st::boxPhotoPadding.right(); int32 w = width() - st::boxPhotoPadding.left() - st::boxPhotoPadding.right();
@ -591,7 +594,8 @@ void EditCaptionBox::paintEvent(QPaintEvent *e) {
p.drawEllipse(inner); p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.setRenderHint(QPainter::HighQualityAntialiasing, false);
p.drawSpriteCenter(inner, _isImage ? st::msgFileInImage : st::msgFileInFile); auto icon = &(_isImage ? st::msgFileInImage : st::msgFileInDocument);
icon->paintInCenter(p, inner);
} }
p.setFont(st::semiboldFont); p.setFont(st::semiboldFont);
p.setPen(st::black); p.setPen(st::black);

View File

@ -22,7 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "core/utils.h" #include "core/utils.h"
#define BETA_VERSION_MACRO (10008003ULL) #define BETA_VERSION_MACRO (10008004ULL)
constexpr int AppVersion = 10008; constexpr int AppVersion = 10008;
constexpr str_const AppVersionStr = "0.10.8"; constexpr str_const AppVersionStr = "0.10.8";

View File

@ -169,6 +169,15 @@ public:
return (_inBubbleState == MediaInBubbleState::Bottom) || (_inBubbleState == MediaInBubbleState::None); return (_inBubbleState == MediaInBubbleState::Bottom) || (_inBubbleState == MediaInBubbleState::None);
} }
// Sometimes click on media in message is overloaded by the messsage:
// (for example it can open a link or a game instead of opening media)
// But the overloading click handler should be used only when media
// is already loaded (not a photo or gif waiting for load with auto
// load being disabled - in such case media should handle the click).
virtual bool isReadyForOpen() const {
return true;
}
protected: protected:
HistoryItem *_parent; HistoryItem *_parent;
int _width = 0; int _width = 0;

View File

@ -408,7 +408,7 @@ void HistoryPhoto::draw(Painter &p, const QRect &r, TextSelection selection, uin
App::roundRect(p, rthumb, textstyleCurrent()->selectOverlay, overlayCorners); App::roundRect(p, rthumb, textstyleCurrent()->selectOverlay, overlayCorners);
} }
if (notChild && (radial || (!loaded && !_data->loading()))) { if (radial || (!loaded && !_data->loading())) {
float64 radialOpacity = (radial && loaded && !_data->uploading()) ? _animation->radial.opacity() : 1; float64 radialOpacity = (radial && loaded && !_data->uploading()) ? _animation->radial.opacity() : 1;
QRect inner(rthumb.x() + (rthumb.width() - st::msgFileSize) / 2, rthumb.y() + (rthumb.height() - st::msgFileSize) / 2, st::msgFileSize, st::msgFileSize); QRect inner(rthumb.x() + (rthumb.width() - st::msgFileSize) / 2, rthumb.y() + (rthumb.height() - st::msgFileSize) / 2, st::msgFileSize, st::msgFileSize);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
@ -432,17 +432,18 @@ void HistoryPhoto::draw(Painter &p, const QRect &r, TextSelection selection, uin
p.setOpacity(radial ? _animation->radial.opacity() : 1); p.setOpacity(radial ? _animation->radial.opacity() : 1);
p.setOpacity(radialOpacity); p.setOpacity(radialOpacity);
style::sprite icon; auto icon = ([radial, this, selected]() -> const style::icon* {
if (radial || _data->loading()) { if (radial || _data->loading()) {
DelayedStorageImage *delayed = _data->full->toDelayedStorageImage(); auto delayed = _data->full->toDelayedStorageImage();
if (!delayed || !delayed->location().isNull()) { if (!delayed || !delayed->location().isNull()) {
icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel); return &(selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
} }
} else { return nullptr;
icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
} }
if (!icon.isEmpty()) { return &(selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
p.drawSpriteCenter(inner, icon); })();
if (icon) {
icon->paintInCenter(p, inner);
} }
if (radial) { if (radial) {
p.setOpacity(1); p.setOpacity(1);
@ -769,15 +770,15 @@ void HistoryVideo::draw(Painter &p, const QRect &r, TextSelection selection, uin
p.setOpacity(1); p.setOpacity(1);
} }
style::sprite icon; auto icon = ([loaded, radial, this, selected] {
if (loaded) { if (loaded) {
icon = (selected ? st::msgFileInPlaySelected : st::msgFileInPlay); return &(selected ? st::msgFileInPlaySelected : st::msgFileInPlay);
} else if (radial || _data->loading()) { } else if (radial || _data->loading()) {
icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel); return &(selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
} else {
icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
} }
p.drawSpriteCenter(inner, icon); return &(selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
})();
icon->paintInCenter(p, inner);
if (radial) { if (radial) {
QRect rinner(inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine))); QRect rinner(inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine)));
_animation->radial.draw(p, rinner, st::msgFileRadialLine, selected ? st::msgInBgSelected : st::msgInBg); _animation->radial.draw(p, rinner, st::msgFileRadialLine, selected ? st::msgInBgSelected : st::msgInBg);
@ -1122,14 +1123,14 @@ void HistoryDocument::draw(Painter &p, const QRect &r, TextSelection selection,
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.setRenderHint(QPainter::HighQualityAntialiasing, false);
p.setOpacity(radialOpacity); p.setOpacity(radialOpacity);
style::sprite icon; auto icon = ([radial, this, selected] {
if (radial || _data->loading()) { if (radial || _data->loading()) {
icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel); return &(selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
} else {
icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
} }
return &(selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
})();
p.setOpacity((radial && loaded) ? _animation->radial.opacity() : 1); p.setOpacity((radial && loaded) ? _animation->radial.opacity() : 1);
p.drawSpriteCenter(inner, icon); icon->paintInCenter(p, inner);
if (radial) { if (radial) {
p.setOpacity(1); p.setOpacity(1);
@ -1174,23 +1175,22 @@ void HistoryDocument::draw(Painter &p, const QRect &r, TextSelection selection,
_animation->radial.draw(p, rinner, st::msgFileRadialLine, bg); _animation->radial.draw(p, rinner, st::msgFileRadialLine, bg);
} }
style::sprite icon; auto icon = ([showPause, radial, this, loaded, outbg, selected] {
if (showPause) { if (showPause) {
icon = outbg ? (selected ? st::msgFileOutPauseSelected : st::msgFileOutPause) : (selected ? st::msgFileInPauseSelected : st::msgFileInPause); return &(outbg ? (selected ? st::msgFileOutPauseSelected : st::msgFileOutPause) : (selected ? st::msgFileInPauseSelected : st::msgFileInPause));
} else if (radial || _data->loading()) { } else if (radial || _data->loading()) {
icon = outbg ? (selected ? st::msgFileOutCancelSelected : st::msgFileOutCancel) : (selected ? st::msgFileInCancelSelected : st::msgFileInCancel); return &(outbg ? (selected ? st::msgFileOutCancelSelected : st::msgFileOutCancel) : (selected ? st::msgFileInCancelSelected : st::msgFileInCancel));
} else if (loaded) { } else if (loaded) {
if (_data->song() || _data->voice()) { if (_data->song() || _data->voice()) {
icon = outbg ? (selected ? st::msgFileOutPlaySelected : st::msgFileOutPlay) : (selected ? st::msgFileInPlaySelected : st::msgFileInPlay); return &(outbg ? (selected ? st::msgFileOutPlaySelected : st::msgFileOutPlay) : (selected ? st::msgFileInPlaySelected : st::msgFileInPlay));
} else if (_data->isImage()) { } else if (_data->isImage()) {
icon = outbg ? (selected ? st::msgFileOutImageSelected : st::msgFileOutImage) : (selected ? st::msgFileInImageSelected : st::msgFileInImage); return &(outbg ? (selected ? st::msgFileOutImageSelected : st::msgFileOutImage) : (selected ? st::msgFileInImageSelected : st::msgFileInImage));
} else {
icon = outbg ? (selected ? st::msgFileOutFileSelected : st::msgFileOutFile) : (selected ? st::msgFileInFileSelected : st::msgFileInFile);
} }
} else { return &(outbg ? (selected ? st::msgFileOutDocumentSelected : st::msgFileOutDocument) : (selected ? st::msgFileInDocumentSelected : st::msgFileInDocument));
icon = outbg ? (selected ? st::msgFileOutDownloadSelected : st::msgFileOutDownload) : (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
} }
p.drawSpriteCenter(inner, icon); return &(outbg ? (selected ? st::msgFileOutDownloadSelected : st::msgFileOutDownload) : (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload));
})();
icon->paintInCenter(p, inner);
} }
int32 namewidth = _width - nameleft - nameright; int32 namewidth = _width - nameleft - nameright;
@ -1746,18 +1746,19 @@ void HistoryGif::draw(Painter &p, const QRect &r, TextSelection selection, uint6
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.setRenderHint(QPainter::HighQualityAntialiasing, false);
p.setOpacity(radialOpacity); p.setOpacity(radialOpacity);
style::sprite icon; auto icon = ([this, radial, selected]() -> const style::icon * {
if (_data->loaded() && !radial) { if (_data->loaded() && !radial) {
icon = (selected ? st::msgFileInPlaySelected : st::msgFileInPlay); return &(selected ? st::msgFileInPlaySelected : st::msgFileInPlay);
} else if (radial || _data->loading()) { } else if (radial || _data->loading()) {
if (_parent->id > 0 || _data->uploading()) { if (_parent->id > 0 || _data->uploading()) {
icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel); return &(selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
} }
} else { return nullptr;
icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
} }
if (!icon.isEmpty()) { return &(selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
p.drawSpriteCenter(inner, icon); })();
if (icon) {
icon->paintInCenter(p, inner);
} }
if (radial) { if (radial) {
p.setOpacity(1); p.setOpacity(1);
@ -2729,11 +2730,13 @@ void HistoryWebPage::draw(Painter &p, const QRect &r, TextSelection selection, u
int32 pixwidth = _attach->currentWidth(), pixheight = _attach->height(); int32 pixwidth = _attach->currentWidth(), pixheight = _attach->height();
if (_data->type == WebPageVideo && _attach->type() == MediaTypePhoto) { if (_data->type == WebPageVideo && _attach->type() == MediaTypePhoto) {
if (_attach->isReadyForOpen()) {
if (_data->siteName == qstr("YouTube")) { if (_data->siteName == qstr("YouTube")) {
p.drawSprite(QPoint((pixwidth - st::youtubeIcon.pxWidth()) / 2, (pixheight - st::youtubeIcon.pxHeight()) / 2), st::youtubeIcon); p.drawSprite(QPoint((pixwidth - st::youtubeIcon.pxWidth()) / 2, (pixheight - st::youtubeIcon.pxHeight()) / 2), st::youtubeIcon);
} else { } else {
p.drawSprite(QPoint((pixwidth - st::videoIcon.pxWidth()) / 2, (pixheight - st::videoIcon.pxHeight()) / 2), st::videoIcon); p.drawSprite(QPoint((pixwidth - st::videoIcon.pxWidth()) / 2, (pixheight - st::videoIcon.pxHeight()) / 2), st::videoIcon);
} }
}
if (_durationWidth) { if (_durationWidth) {
int32 dateX = pixwidth - _durationWidth - st::msgDateImgDelta - 2 * st::msgDateImgPadding.x(); int32 dateX = pixwidth - _durationWidth - st::msgDateImgDelta - 2 * st::msgDateImgPadding.x();
int32 dateY = pixheight - st::msgDateFont->height - 2 * st::msgDateImgPadding.y() - st::msgDateImgDelta; int32 dateY = pixheight - st::msgDateFont->height - 2 * st::msgDateImgPadding.y() - st::msgDateImgDelta;
@ -2811,7 +2814,7 @@ HistoryTextState HistoryWebPage::getState(int x, int y, HistoryStateRequest requ
if (rtl()) attachLeft = _width - attachLeft - _attach->currentWidth(); if (rtl()) attachLeft = _width - attachLeft - _attach->currentWidth();
result = _attach->getState(x - attachLeft, y - attachTop, request); result = _attach->getState(x - attachLeft, y - attachTop, request);
if (result.link && !_data->document && _data->photo) { if (result.link && !_data->document && _data->photo && _attach->isReadyForOpen()) {
if (_data->type == WebPageProfile || _data->type == WebPageVideo) { if (_data->type == WebPageProfile || _data->type == WebPageVideo) {
result.link = _openl; result.link = _openl;
} else if (_data->type == WebPagePhoto || _data->siteName == qstr("Twitter") || _data->siteName == qstr("Facebook")) { } else if (_data->type == WebPagePhoto || _data->siteName == qstr("Twitter") || _data->siteName == qstr("Facebook")) {
@ -3160,7 +3163,11 @@ HistoryTextState HistoryGame::getState(int x, int y, HistoryStateRequest request
if (rtl()) attachLeft = _width - attachLeft - _attach->currentWidth(); if (rtl()) attachLeft = _width - attachLeft - _attach->currentWidth();
if (x >= attachLeft && x < attachLeft + _attach->currentWidth() && y >= tshift && y < _height - bshift) { if (x >= attachLeft && x < attachLeft + _attach->currentWidth() && y >= tshift && y < _height - bshift) {
if (_attach->isReadyForOpen()) {
result.link = _openl; result.link = _openl;
} else {
result = _attach->getState(x - attachLeft, y - attachTop, request);
}
} }
} }

View File

@ -172,6 +172,9 @@ public:
bool hideFromName() const override { bool hideFromName() const override {
return true; return true;
} }
bool isReadyForOpen() const override {
return _data->loaded();
}
protected: protected:
float64 dataProgress() const override { float64 dataProgress() const override {
@ -481,6 +484,9 @@ public:
bool hideFromName() const override { bool hideFromName() const override {
return true; return true;
} }
bool isReadyForOpen() const override {
return _data->loaded();
}
~HistoryGif(); ~HistoryGif();

View File

@ -494,7 +494,7 @@ void HistoryMessage::updateMediaInBubbleState() {
return; return;
} }
bool hasSomethingAbove = displayFromName() || displayForwardedFrom() || Has<HistoryMessageVia>(); bool hasSomethingAbove = displayFromName() || displayForwardedFrom() || Has<HistoryMessageReply>() || Has<HistoryMessageVia>();
bool hasSomethingBelow = false; bool hasSomethingBelow = false;
if (!emptyText()) { if (!emptyText()) {
if (_media->isAboveMessage()) { if (_media->isAboveMessage()) {

View File

@ -177,16 +177,16 @@ void Gif::paint(Painter &p, const QRect &clip, const PaintContext *context) cons
p.setOpacity(radialOpacity * p.opacity()); p.setOpacity(radialOpacity * p.opacity());
p.setOpacity(radialOpacity); p.setOpacity(radialOpacity);
style::sprite icon; auto icon = ([loaded, radial, loading] {
if (loaded && !radial) { if (loaded && !radial) {
icon = st::msgFileInPlay; return &st::msgFileInPlay;
} else if (radial || loading) { } else if (radial || loading) {
icon = st::msgFileInCancel; return &st::msgFileInCancel;
} else {
icon = st::msgFileInDownload;
} }
return &st::msgFileInDownload;
})();
QRect inner((_width - st::msgFileSize) / 2, (height - st::msgFileSize) / 2, st::msgFileSize, st::msgFileSize); QRect inner((_width - st::msgFileSize) / 2, (height - st::msgFileSize) / 2, st::msgFileSize, st::msgFileSize);
p.drawSpriteCenter(inner, icon); icon->paintInCenter(p, inner);
if (radial) { if (radial) {
p.setOpacity(1); p.setOpacity(1);
QRect rinner(inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine))); QRect rinner(inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine)));
@ -702,7 +702,7 @@ void File::paint(Painter &p, const QRect &clip, const PaintContext *context) con
bool showPause = updateStatusText(); bool showPause = updateStatusText();
bool radial = isRadialAnimation(context->ms); bool radial = isRadialAnimation(context->ms);
QRect iconCircle = rtlrect(0, st::inlineRowMargin, st::msgFileSize, st::msgFileSize, _width); auto inner = rtlrect(0, st::inlineRowMargin, st::msgFileSize, st::msgFileSize, _width);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
if (isThumbAnimation(context->ms)) { if (isThumbAnimation(context->ms)) {
float64 over = _animation->a_thumbOver.current(); float64 over = _animation->a_thumbOver.current();
@ -713,31 +713,30 @@ void File::paint(Painter &p, const QRect &clip, const PaintContext *context) con
} }
p.setRenderHint(QPainter::HighQualityAntialiasing); p.setRenderHint(QPainter::HighQualityAntialiasing);
p.drawEllipse(iconCircle); p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.setRenderHint(QPainter::HighQualityAntialiasing, false);
if (radial) { if (radial) {
QRect radialCircle(iconCircle.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine))); auto radialCircle = inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine));
_animation->radial.draw(p, radialCircle, st::msgFileRadialLine, st::msgInBg); _animation->radial.draw(p, radialCircle, st::msgFileRadialLine, st::msgInBg);
} }
style::sprite icon; auto icon = ([showPause, radial, document] {
if (showPause) { if (showPause) {
icon = st::msgFileInPause; return &st::msgFileInPause;
} else if (radial || document->loading()) { } else if (radial || document->loading()) {
icon = st::msgFileInCancel; return &st::msgFileInCancel;
} else if (true || document->loaded()) { } else if (true || document->loaded()) {
if (document->isImage()) { if (document->isImage()) {
icon = st::msgFileInImage; return &st::msgFileInImage;
} else if (document->voice() || document->song()) { } else if (document->voice() || document->song()) {
icon = st::msgFileInPlay; return &st::msgFileInPlay;
} else {
icon = st::msgFileInFile;
} }
} else { return &st::msgFileInDocument;
icon = st::msgFileInDownload;
} }
p.drawSpriteCenter(iconCircle, icon); return &st::msgFileInDownload;
})();
icon->paintInCenter(p, inner);
int titleTop = st::inlineRowMargin + st::inlineRowFileNameTop; int titleTop = st::inlineRowMargin + st::inlineRowFileNameTop;
int descriptionTop = st::inlineRowMargin + st::inlineRowFileDescriptionTop; int descriptionTop = st::inlineRowMargin + st::inlineRowFileDescriptionTop;

View File

@ -333,15 +333,15 @@ void Video::paint(Painter &p, const QRect &clip, TextSelection selection, const
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.setRenderHint(QPainter::HighQualityAntialiasing, false);
p.setOpacity((radial && loaded) ? _radial->opacity() : 1); p.setOpacity((radial && loaded) ? _radial->opacity() : 1);
style::sprite icon; auto icon = ([radial, loaded, selected] {
if (radial) { if (radial) {
icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel); return &(selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
} else if (loaded) { } else if (loaded) {
icon = (selected ? st::msgFileInPlaySelected : st::msgFileInPlay); return &(selected ? st::msgFileInPlaySelected : st::msgFileInPlay);
} else {
icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
} }
p.drawSpriteCenter(inner, icon); return &(selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
})();
icon->paintInCenter(p, inner);
if (radial) { if (radial) {
p.setOpacity(1); p.setOpacity(1);
QRect rinner(inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine))); QRect rinner(inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine)));
@ -461,17 +461,17 @@ void Voice::paint(Painter &p, const QRect &clip, TextSelection selection, const
_radial->draw(p, rinner, st::msgFileRadialLine, bg); _radial->draw(p, rinner, st::msgFileRadialLine, bg);
} }
style::sprite icon; auto icon = ([showPause, this, selected] {
if (showPause) { if (showPause) {
icon = selected ? st::msgFileInPauseSelected : st::msgFileInPause; return &(selected ? st::msgFileInPauseSelected : st::msgFileInPause);
} else if (_statusSize < 0 || _statusSize == FileStatusSizeLoaded) { } else if (_statusSize < 0 || _statusSize == FileStatusSizeLoaded) {
icon = selected ? st::msgFileInPlaySelected : st::msgFileInPlay; return &(selected ? st::msgFileInPlaySelected : st::msgFileInPlay);
} else if (_data->loading()) { } else if (_data->loading()) {
icon = selected ? st::msgFileInCancelSelected : st::msgFileInCancel; return &(selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
} else {
icon = selected ? st::msgFileInDownloadSelected : st::msgFileInDownload;
} }
p.drawSpriteCenter(inner, icon); return &(selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
})();
icon->paintInCenter(p, inner);
} }
int32 namewidth = _width - nameleft - nameright; int32 namewidth = _width - nameleft - nameright;
@ -672,17 +672,17 @@ void Document::paint(Painter &p, const QRect &clip, TextSelection selection, con
_radial->draw(p, rinner, st::msgFileRadialLine, bg); _radial->draw(p, rinner, st::msgFileRadialLine, bg);
} }
style::sprite icon; auto icon = ([showPause, loaded, this, selected] {
if (showPause) { if (showPause) {
icon = selected ? st::msgFileInPauseSelected : st::msgFileInPause; return &(selected ? st::msgFileInPauseSelected : st::msgFileInPause);
} else if (loaded) { } else if (loaded) {
icon = selected ? st::msgFileInPlaySelected : st::msgFileInPlay; return &(selected ? st::msgFileInPlaySelected : st::msgFileInPlay);
} else if (_data->loading()) { } else if (_data->loading()) {
icon = selected ? st::msgFileInCancelSelected : st::msgFileInCancel; return &(selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
} else {
icon = selected ? st::msgFileInDownloadSelected : st::msgFileInDownload;
} }
p.drawSpriteCenter(inner, icon); return &(selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
})();
icon->paintInCenter(p, inner);
} }
} else { } else {
nameleft = st::overviewFileSize + st::overviewFilePadding.right(); nameleft = st::overviewFileSize + st::overviewFilePadding.right();
@ -748,13 +748,13 @@ void Document::paint(Painter &p, const QRect &clip, TextSelection selection, con
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.setRenderHint(QPainter::HighQualityAntialiasing, false);
p.setOpacity(radialOpacity); p.setOpacity(radialOpacity);
style::sprite icon; auto icon = ([loaded, this, selected] {
if (loaded || _data->loading()) { if (loaded || _data->loading()) {
icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel); return &(selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
} else {
icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
} }
p.drawSpriteCenter(inner, icon); return &(selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
})();
icon->paintInCenter(p, inner);
if (radial) { if (radial) {
p.setOpacity(1); p.setOpacity(1);

View File

@ -529,7 +529,7 @@ private:
}; };
_PsShadowWindows _psShadowWindows; _PsShadowWindows _psShadowWindows;
QColor _shActive(0, 0, 0), _shInactive(0, 0, 0); QColor _shActive(0, 0, 0)/*, _shInactive(0, 0, 0)*/;
LRESULT CALLBACK _PsShadowWindows::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { LRESULT CALLBACK _PsShadowWindows::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
auto wnd = App::wnd(); auto wnd = App::wnd();
@ -633,12 +633,12 @@ void MainWindow::shadowsUpdate(ShadowsChanges changes, WINDOWPOS *position) {
} }
void MainWindow::shadowsActivate() { void MainWindow::shadowsActivate() {
_psShadowWindows.setColor(_shActive); // _psShadowWindows.setColor(_shActive);
shadowsUpdate(ShadowsChange::Activate); shadowsUpdate(ShadowsChange::Activate);
} }
void MainWindow::shadowsDeactivate() { void MainWindow::shadowsDeactivate() {
_psShadowWindows.setColor(_shInactive); // _psShadowWindows.setColor(_shInactive);
} }
void MainWindow::psShowTrayMenu() { void MainWindow::psShowTrayMenu() {

View File

@ -89,8 +89,8 @@ public:
Icon(const ColoredCopy &makeCopy) { Icon(const ColoredCopy &makeCopy) {
_parts.reserve(makeCopy.copyFrom._parts.size()); _parts.reserve(makeCopy.copyFrom._parts.size());
auto colorIt = makeCopy.colors.cbegin(), colorsEnd = makeCopy.colors.cend(); auto colorIt = makeCopy.colors.cbegin(), colorsEnd = makeCopy.colors.cend();
for_const (const auto &part, makeCopy.copyFrom._parts) { for_const (auto &part, makeCopy.copyFrom._parts) {
const auto &newPart = part.clone((colorIt == colorsEnd) ? Color(Qt::Uninitialized) : *(colorIt++)); auto &newPart = part.clone((colorIt == colorsEnd) ? Color(Qt::Uninitialized) : *(colorIt++));
_parts.push_back(newPart); _parts.push_back(newPart);
} }
} }
@ -106,6 +106,12 @@ public:
} }
void paint(QPainter &p, const QPoint &pos, int outerw) const; void paint(QPainter &p, const QPoint &pos, int outerw) const;
void paint(QPainter &p, int x, int y, int outerw) const {
paint(p, QPoint(x, y), outerw);
}
void paintInCenter(QPainter &p, const QRect &outer) const {
paint(p, outer.x() + (outer.width() - width()) / 2, outer.y() + (outer.height() - height()) / 2, outer.x() * 2 + outer.width());
}
void fill(QPainter &p, const QRect &rect) const; void fill(QPainter &p, const QRect &rect) const;
int width() const; int width() const;
int height() const; int height() const;

View File

@ -3,4 +3,4 @@ AppVersionStrMajor 0.10
AppVersionStrSmall 0.10.8 AppVersionStrSmall 0.10.8
AppVersionStr 0.10.8 AppVersionStr 0.10.8
AlphaChannel 0 AlphaChannel 0
BetaVersion 10008003 BetaVersion 10008004