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;
msgFileOutBgSelected: #5fb389;
msgFileOutImage: sprite(0px, 146px, 18px, 18px);
msgFileOutImageSelected: sprite(18px, 146px, 18px, 18px);
msgFileInImage: sprite(0px, 164px, 18px, 18px);
msgFileInImageSelected: sprite(18px, 164px, 18px, 18px);
msgFileOutFile: sprite(36px, 146px, 18px, 18px);
msgFileOutFileSelected: sprite(54px, 146px, 18px, 18px);
msgFileInFile: sprite(36px, 164px, 18px, 18px);
msgFileInFileSelected: sprite(54px, 164px, 18px, 18px);
msgFileOutDownload: sprite(72px, 142px, 14px, 20px);
msgFileOutDownloadSelected: sprite(86px, 142px, 14px, 20px);
msgFileInDownload: sprite(72px, 162px, 14px, 20px);
msgFileInDownloadSelected: sprite(86px, 162px, 14px, 20px);
msgFileOutCancel: sprite(100px, 147px, 16px, 16px);
msgFileOutCancelSelected: sprite(116px, 147px, 16px, 16px);
msgFileInCancel: sprite(100px, 165px, 16px, 16px);
msgFileInCancelSelected: sprite(116px, 165px, 16px, 16px);
msgFileOutPause: sprite(132px, 147px, 14px, 16px);
msgFileOutPauseSelected: sprite(146px, 147px, 14px, 16px);
msgFileInPause: sprite(132px, 165px, 14px, 16px);
msgFileInPauseSelected: sprite(146px, 165px, 14px, 16px);
msgFileOutPlay: sprite(160px, 146px, 20px, 18px);
msgFileOutPlaySelected: sprite(180px, 146px, 20px, 18px);
msgFileInPlay: sprite(160px, 164px, 20px, 18px);
msgFileInPlaySelected: sprite(180px, 164px, 20px, 18px);
msgFileOutImage: icon {
{ "msg_file_image", msgOutBg },
};
msgFileOutImageSelected: icon {
{ "msg_file_image", msgOutBgSelected },
};
msgFileInImage: icon {
{ "msg_file_image", msgInBg },
};
msgFileInImageSelected: icon {
{ "msg_file_image", msgInBgSelected },
};
msgFileOutDocument: icon {
{ "msg_file_document", msgOutBg },
};
msgFileOutDocumentSelected: icon {
{ "msg_file_document", msgOutBgSelected },
};
msgFileInDocument: icon {
{ "msg_file_document", msgInBg },
};
msgFileInDocumentSelected: icon {
{ "msg_file_document", msgInBgSelected },
};
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);
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
FILEVERSION 0,10,8,3
PRODUCTVERSION 0,10,8,3
FILEVERSION 0,10,8,4
PRODUCTVERSION 0,10,8,4
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@ -51,10 +51,10 @@ BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "Telegram Messenger LLP"
VALUE "FileVersion", "0.10.8.3"
VALUE "FileVersion", "0.10.8.4"
VALUE "LegalCopyright", "Copyright (C) 2014-2016"
VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "0.10.8.3"
VALUE "ProductVersion", "0.10.8.4"
END
END
BLOCK "VarFileInfo"

View File

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

View File

@ -233,7 +233,8 @@ void PhotoSendBox::paintEvent(QPaintEvent *e) {
p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
p.drawSpriteCenter(inner, st::msgFileInPlay);
auto icon = &st::msgFileInPlay;
icon->paintInCenter(p, inner);
}
} else {
int32 w = width() - st::boxPhotoPadding.left() - st::boxPhotoPadding.right();
@ -272,7 +273,8 @@ void PhotoSendBox::paintEvent(QPaintEvent *e) {
p.drawEllipse(inner);
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 {
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.setRenderHint(QPainter::HighQualityAntialiasing, false);
p.drawSpriteCenter(inner, st::msgFileInPlay);
auto icon = &st::msgFileInPlay;
icon->paintInCenter(p, inner);
}
} else if (_doc) {
int32 w = width() - st::boxPhotoPadding.left() - st::boxPhotoPadding.right();
@ -591,7 +594,8 @@ void EditCaptionBox::paintEvent(QPaintEvent *e) {
p.drawEllipse(inner);
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.setPen(st::black);

View File

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

View File

@ -169,6 +169,15 @@ public:
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:
HistoryItem *_parent;
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);
}
if (notChild && (radial || (!loaded && !_data->loading()))) {
if (radial || (!loaded && !_data->loading())) {
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);
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(radialOpacity);
style::sprite icon;
if (radial || _data->loading()) {
DelayedStorageImage *delayed = _data->full->toDelayedStorageImage();
if (!delayed || !delayed->location().isNull()) {
icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
auto icon = ([radial, this, selected]() -> const style::icon* {
if (radial || _data->loading()) {
auto delayed = _data->full->toDelayedStorageImage();
if (!delayed || !delayed->location().isNull()) {
return &(selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
}
return nullptr;
}
} else {
icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
}
if (!icon.isEmpty()) {
p.drawSpriteCenter(inner, icon);
return &(selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
})();
if (icon) {
icon->paintInCenter(p, inner);
}
if (radial) {
p.setOpacity(1);
@ -769,15 +770,15 @@ void HistoryVideo::draw(Painter &p, const QRect &r, TextSelection selection, uin
p.setOpacity(1);
}
style::sprite icon;
if (loaded) {
icon = (selected ? st::msgFileInPlaySelected : st::msgFileInPlay);
} else if (radial || _data->loading()) {
icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
} else {
icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
}
p.drawSpriteCenter(inner, icon);
auto icon = ([loaded, radial, this, selected] {
if (loaded) {
return &(selected ? st::msgFileInPlaySelected : st::msgFileInPlay);
} else if (radial || _data->loading()) {
return &(selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
}
return &(selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
})();
icon->paintInCenter(p, inner);
if (radial) {
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);
@ -1122,14 +1123,14 @@ void HistoryDocument::draw(Painter &p, const QRect &r, TextSelection selection,
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
p.setOpacity(radialOpacity);
style::sprite icon;
if (radial || _data->loading()) {
icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
} else {
icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
}
auto icon = ([radial, this, selected] {
if (radial || _data->loading()) {
return &(selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
}
return &(selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
})();
p.setOpacity((radial && loaded) ? _animation->radial.opacity() : 1);
p.drawSpriteCenter(inner, icon);
icon->paintInCenter(p, inner);
if (radial) {
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);
}
style::sprite icon;
if (showPause) {
icon = outbg ? (selected ? st::msgFileOutPauseSelected : st::msgFileOutPause) : (selected ? st::msgFileInPauseSelected : st::msgFileInPause);
} else if (radial || _data->loading()) {
icon = outbg ? (selected ? st::msgFileOutCancelSelected : st::msgFileOutCancel) : (selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
} else if (loaded) {
if (_data->song() || _data->voice()) {
icon = outbg ? (selected ? st::msgFileOutPlaySelected : st::msgFileOutPlay) : (selected ? st::msgFileInPlaySelected : st::msgFileInPlay);
} else if (_data->isImage()) {
icon = outbg ? (selected ? st::msgFileOutImageSelected : st::msgFileOutImage) : (selected ? st::msgFileInImageSelected : st::msgFileInImage);
} else {
icon = outbg ? (selected ? st::msgFileOutFileSelected : st::msgFileOutFile) : (selected ? st::msgFileInFileSelected : st::msgFileInFile);
auto icon = ([showPause, radial, this, loaded, outbg, selected] {
if (showPause) {
return &(outbg ? (selected ? st::msgFileOutPauseSelected : st::msgFileOutPause) : (selected ? st::msgFileInPauseSelected : st::msgFileInPause));
} else if (radial || _data->loading()) {
return &(outbg ? (selected ? st::msgFileOutCancelSelected : st::msgFileOutCancel) : (selected ? st::msgFileInCancelSelected : st::msgFileInCancel));
} else if (loaded) {
if (_data->song() || _data->voice()) {
return &(outbg ? (selected ? st::msgFileOutPlaySelected : st::msgFileOutPlay) : (selected ? st::msgFileInPlaySelected : st::msgFileInPlay));
} else if (_data->isImage()) {
return &(outbg ? (selected ? st::msgFileOutImageSelected : st::msgFileOutImage) : (selected ? st::msgFileInImageSelected : st::msgFileInImage));
}
return &(outbg ? (selected ? st::msgFileOutDocumentSelected : st::msgFileOutDocument) : (selected ? st::msgFileInDocumentSelected : st::msgFileInDocument));
}
} else {
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;
@ -1746,18 +1746,19 @@ void HistoryGif::draw(Painter &p, const QRect &r, TextSelection selection, uint6
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
p.setOpacity(radialOpacity);
style::sprite icon;
if (_data->loaded() && !radial) {
icon = (selected ? st::msgFileInPlaySelected : st::msgFileInPlay);
} else if (radial || _data->loading()) {
if (_parent->id > 0 || _data->uploading()) {
icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
auto icon = ([this, radial, selected]() -> const style::icon * {
if (_data->loaded() && !radial) {
return &(selected ? st::msgFileInPlaySelected : st::msgFileInPlay);
} else if (radial || _data->loading()) {
if (_parent->id > 0 || _data->uploading()) {
return &(selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
}
return nullptr;
}
} else {
icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
}
if (!icon.isEmpty()) {
p.drawSpriteCenter(inner, icon);
return &(selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
})();
if (icon) {
icon->paintInCenter(p, inner);
}
if (radial) {
p.setOpacity(1);
@ -2729,10 +2730,12 @@ void HistoryWebPage::draw(Painter &p, const QRect &r, TextSelection selection, u
int32 pixwidth = _attach->currentWidth(), pixheight = _attach->height();
if (_data->type == WebPageVideo && _attach->type() == MediaTypePhoto) {
if (_data->siteName == qstr("YouTube")) {
p.drawSprite(QPoint((pixwidth - st::youtubeIcon.pxWidth()) / 2, (pixheight - st::youtubeIcon.pxHeight()) / 2), st::youtubeIcon);
} else {
p.drawSprite(QPoint((pixwidth - st::videoIcon.pxWidth()) / 2, (pixheight - st::videoIcon.pxHeight()) / 2), st::videoIcon);
if (_attach->isReadyForOpen()) {
if (_data->siteName == qstr("YouTube")) {
p.drawSprite(QPoint((pixwidth - st::youtubeIcon.pxWidth()) / 2, (pixheight - st::youtubeIcon.pxHeight()) / 2), st::youtubeIcon);
} else {
p.drawSprite(QPoint((pixwidth - st::videoIcon.pxWidth()) / 2, (pixheight - st::videoIcon.pxHeight()) / 2), st::videoIcon);
}
}
if (_durationWidth) {
int32 dateX = pixwidth - _durationWidth - st::msgDateImgDelta - 2 * st::msgDateImgPadding.x();
@ -2811,7 +2814,7 @@ HistoryTextState HistoryWebPage::getState(int x, int y, HistoryStateRequest requ
if (rtl()) attachLeft = _width - attachLeft - _attach->currentWidth();
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) {
result.link = _openl;
} 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 (x >= attachLeft && x < attachLeft + _attach->currentWidth() && y >= tshift && y < _height - bshift) {
result.link = _openl;
if (_attach->isReadyForOpen()) {
result.link = _openl;
} else {
result = _attach->getState(x - attachLeft, y - attachTop, request);
}
}
}

View File

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

View File

@ -494,7 +494,7 @@ void HistoryMessage::updateMediaInBubbleState() {
return;
}
bool hasSomethingAbove = displayFromName() || displayForwardedFrom() || Has<HistoryMessageVia>();
bool hasSomethingAbove = displayFromName() || displayForwardedFrom() || Has<HistoryMessageReply>() || Has<HistoryMessageVia>();
bool hasSomethingBelow = false;
if (!emptyText()) {
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);
style::sprite icon;
if (loaded && !radial) {
icon = st::msgFileInPlay;
} else if (radial || loading) {
icon = st::msgFileInCancel;
} else {
icon = st::msgFileInDownload;
}
auto icon = ([loaded, radial, loading] {
if (loaded && !radial) {
return &st::msgFileInPlay;
} else if (radial || loading) {
return &st::msgFileInCancel;
}
return &st::msgFileInDownload;
})();
QRect inner((_width - st::msgFileSize) / 2, (height - st::msgFileSize) / 2, st::msgFileSize, st::msgFileSize);
p.drawSpriteCenter(inner, icon);
icon->paintInCenter(p, inner);
if (radial) {
p.setOpacity(1);
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 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);
if (isThumbAnimation(context->ms)) {
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.drawEllipse(iconCircle);
p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
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);
}
style::sprite icon;
if (showPause) {
icon = st::msgFileInPause;
} else if (radial || document->loading()) {
icon = st::msgFileInCancel;
} else if (true || document->loaded()) {
if (document->isImage()) {
icon = st::msgFileInImage;
} else if (document->voice() || document->song()) {
icon = st::msgFileInPlay;
} else {
icon = st::msgFileInFile;
auto icon = ([showPause, radial, document] {
if (showPause) {
return &st::msgFileInPause;
} else if (radial || document->loading()) {
return &st::msgFileInCancel;
} else if (true || document->loaded()) {
if (document->isImage()) {
return &st::msgFileInImage;
} else if (document->voice() || document->song()) {
return &st::msgFileInPlay;
}
return &st::msgFileInDocument;
}
} else {
icon = st::msgFileInDownload;
}
p.drawSpriteCenter(iconCircle, icon);
return &st::msgFileInDownload;
})();
icon->paintInCenter(p, inner);
int titleTop = st::inlineRowMargin + st::inlineRowFileNameTop;
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.setOpacity((radial && loaded) ? _radial->opacity() : 1);
style::sprite icon;
if (radial) {
icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
} else if (loaded) {
icon = (selected ? st::msgFileInPlaySelected : st::msgFileInPlay);
} else {
icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
}
p.drawSpriteCenter(inner, icon);
auto icon = ([radial, loaded, selected] {
if (radial) {
return &(selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
} else if (loaded) {
return &(selected ? st::msgFileInPlaySelected : st::msgFileInPlay);
}
return &(selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
})();
icon->paintInCenter(p, inner);
if (radial) {
p.setOpacity(1);
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);
}
style::sprite icon;
if (showPause) {
icon = selected ? st::msgFileInPauseSelected : st::msgFileInPause;
} else if (_statusSize < 0 || _statusSize == FileStatusSizeLoaded) {
icon = selected ? st::msgFileInPlaySelected : st::msgFileInPlay;
} else if (_data->loading()) {
icon = selected ? st::msgFileInCancelSelected : st::msgFileInCancel;
} else {
icon = selected ? st::msgFileInDownloadSelected : st::msgFileInDownload;
}
p.drawSpriteCenter(inner, icon);
auto icon = ([showPause, this, selected] {
if (showPause) {
return &(selected ? st::msgFileInPauseSelected : st::msgFileInPause);
} else if (_statusSize < 0 || _statusSize == FileStatusSizeLoaded) {
return &(selected ? st::msgFileInPlaySelected : st::msgFileInPlay);
} else if (_data->loading()) {
return &(selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
}
return &(selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
})();
icon->paintInCenter(p, inner);
}
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);
}
style::sprite icon;
if (showPause) {
icon = selected ? st::msgFileInPauseSelected : st::msgFileInPause;
} else if (loaded) {
icon = selected ? st::msgFileInPlaySelected : st::msgFileInPlay;
} else if (_data->loading()) {
icon = selected ? st::msgFileInCancelSelected : st::msgFileInCancel;
} else {
icon = selected ? st::msgFileInDownloadSelected : st::msgFileInDownload;
}
p.drawSpriteCenter(inner, icon);
auto icon = ([showPause, loaded, this, selected] {
if (showPause) {
return &(selected ? st::msgFileInPauseSelected : st::msgFileInPause);
} else if (loaded) {
return &(selected ? st::msgFileInPlaySelected : st::msgFileInPlay);
} else if (_data->loading()) {
return &(selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
}
return &(selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
})();
icon->paintInCenter(p, inner);
}
} else {
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.setOpacity(radialOpacity);
style::sprite icon;
if (loaded || _data->loading()) {
icon = (selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
} else {
icon = (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
}
p.drawSpriteCenter(inner, icon);
auto icon = ([loaded, this, selected] {
if (loaded || _data->loading()) {
return &(selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
}
return &(selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
})();
icon->paintInCenter(p, inner);
if (radial) {
p.setOpacity(1);

View File

@ -529,7 +529,7 @@ private:
};
_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) {
auto wnd = App::wnd();
@ -633,12 +633,12 @@ void MainWindow::shadowsUpdate(ShadowsChanges changes, WINDOWPOS *position) {
}
void MainWindow::shadowsActivate() {
_psShadowWindows.setColor(_shActive);
// _psShadowWindows.setColor(_shActive);
shadowsUpdate(ShadowsChange::Activate);
}
void MainWindow::shadowsDeactivate() {
_psShadowWindows.setColor(_shInactive);
// _psShadowWindows.setColor(_shInactive);
}
void MainWindow::psShowTrayMenu() {

View File

@ -89,8 +89,8 @@ public:
Icon(const ColoredCopy &makeCopy) {
_parts.reserve(makeCopy.copyFrom._parts.size());
auto colorIt = makeCopy.colors.cbegin(), colorsEnd = makeCopy.colors.cend();
for_const (const auto &part, makeCopy.copyFrom._parts) {
const auto &newPart = part.clone((colorIt == colorsEnd) ? Color(Qt::Uninitialized) : *(colorIt++));
for_const (auto &part, makeCopy.copyFrom._parts) {
auto &newPart = part.clone((colorIt == colorsEnd) ? Color(Qt::Uninitialized) : *(colorIt++));
_parts.push_back(newPart);
}
}
@ -106,6 +106,12 @@ public:
}
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;
int width() const;
int height() const;

View File

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