Closed beta 10019011: various style improvements.

This commit is contained in:
John Preston 2016-12-03 15:10:35 +03:00
parent 2796c53542
commit b0f14d1856
60 changed files with 441 additions and 313 deletions

View file

@ -70,11 +70,6 @@ slideShift: 100px;
slideFadeOutBg: #0000003c; slideFadeOutBg: #0000003c;
slideShadow: icon {{ "slide_shadow", windowShadowFg }}; slideShadow: icon {{ "slide_shadow", windowShadowFg }};
btnYesColor: #0080c0;
btnYesHover: #0073ad;
btnNoColor: #8b8b8b;
btnNoHover: #777777;
linkCropLimit: 360px; linkCropLimit: 360px;
linkFont: normalFont; linkFont: normalFont;
linkOverFont: font(fsize underline); linkOverFont: font(fsize underline);
@ -82,8 +77,6 @@ linkOverFont: font(fsize underline);
dateRadius: 6px; dateRadius: 6px;
buttonRadius: 3px; buttonRadius: 3px;
lnkText: #0f7dc7;
setLittleSkip: 9px; setLittleSkip: 9px;
noContactsHeight: 100px; noContactsHeight: 100px;
@ -114,8 +107,8 @@ msgOutBg: #effdde;
msgOutBgSelected: #b7dbdb; msgOutBgSelected: #b7dbdb;
msgSelectOverlay: #358cd44c; msgSelectOverlay: #358cd44c;
msgStickerOverlay: #358cd47f; msgStickerOverlay: #358cd47f;
msgInServiceFg: #0e7acd; msgInServiceFg: windowActiveTextFg;
msgInServiceFgSelected: #0e7acd; msgInServiceFgSelected: windowActiveTextFg;
msgOutServiceFg: #3a8e26; msgOutServiceFg: #3a8e26;
msgOutServiceFgSelected: #367570; msgOutServiceFgSelected: #367570;
msgShadow: 2px; msgShadow: 2px;
@ -132,8 +125,8 @@ msgReplyPadding: margins(6px, 6px, 11px, 6px);
msgReplyBarPos: point(1px, 0px); msgReplyBarPos: point(1px, 0px);
msgReplyBarSize: size(2px, 36px); msgReplyBarSize: size(2px, 36px);
msgReplyBarSkip: 10px; msgReplyBarSkip: 10px;
msgInReplyBarColor: #2fa9e2; msgInReplyBarColor: activeLineFg;
msgInReplyBarSelColor: #2fa9e2; msgInReplyBarSelColor: activeLineFg;
msgOutReplyBarColor: historyOutIconFg; msgOutReplyBarColor: historyOutIconFg;
msgOutReplyBarSelColor: historyOutIconFgSelected; msgOutReplyBarSelColor: historyOutIconFgSelected;
msgImgReplyBarColor: #ffffff; msgImgReplyBarColor: #ffffff;
@ -146,10 +139,6 @@ msgServiceMargin: margins(10px, 10px, 80px, 2px);
msgColor: #000000; msgColor: #000000;
msgDateColor: #000000; msgDateColor: #000000;
msgLinkColor: #2a6dc2;
msgPressedLinkColor: #004bad;
msgSkip: 40px;
msgPtr: 8px;
msgDateSpace: 12px; msgDateSpace: 12px;
msgDateDelta: point(2px, 5px); msgDateDelta: point(2px, 5px);
@ -165,8 +154,8 @@ msgDateImgCheckSpace: 4px;
defaultTextStyle: TextStyle { defaultTextStyle: TextStyle {
linkFlags: font(fsize); linkFlags: font(fsize);
linkFlagsOver: font(fsize underline); linkFlagsOver: font(fsize underline);
linkFg: btnYesColor; linkFg: windowActiveTextFg;
linkFgDown: btnYesHover; linkFgDown: windowActiveTextFg;
monoFg: #777777; monoFg: #777777;
selectBg: msgInBgSelected; selectBg: msgInBgSelected;
selectOverlay: msgSelectOverlay; selectOverlay: msgSelectOverlay;
@ -214,7 +203,7 @@ medviewSaveAsTextStyle: TextStyle(defaultTextStyle) {
linkFgDown: #91d9ff; linkFgDown: #91d9ff;
} }
mediaPadding: margins(0px, 0px, 0px, 0px);//1px, 1px, 1px, 1px);//2px, 2px, 2px, 2px); mediaPadding: margins(0px, 0px, 0px, 0px);
mediaCaptionSkip: 5px; mediaCaptionSkip: 5px;
mediaInBubbleSkip: 5px; mediaInBubbleSkip: 5px;
mediaThumbSize: 48px; mediaThumbSize: 48px;
@ -310,10 +299,11 @@ unreadBarBorder: shadowColor;
unreadBarColor: #538bb4; unreadBarColor: #538bb4;
searchedBarHeight: unreadBarHeight; searchedBarHeight: unreadBarHeight;
searchedBarFont: unreadBarFont; searchedBarFont: normalFont;
searchedBarBG: #ebeef1; searchedBarBg: windowBgOver;
searchedBarBorder: unreadBarBorder; searchedBarBorder: unreadBarBorder;
searchedBarColor: #a2aeb7; searchedBarFg: windowSubTextFgOver;
searchedBarPosition: point(17px, 7px);
simpleCloseIcon: icon {{ "simple_close", #c7c7c7 }}; simpleCloseIcon: icon {{ "simple_close", #c7c7c7 }};
simpleCloseIconOver: icon {{ "simple_close", #a3a3a3 }}; simpleCloseIconOver: icon {{ "simple_close", #a3a3a3 }};
@ -346,7 +336,7 @@ dragBg: #ffffff;
dragFont: font(28px semibold); dragFont: font(28px semibold);
dragSubfont: font(20px semibold); dragSubfont: font(20px semibold);
dragColor: #777777; dragColor: #777777;
dragDropColor: btnYesColor; dragDropColor: windowActiveTextFg;
dragMargin: margins(0px, 10px, 0px, 10px); dragMargin: margins(0px, 10px, 0px, 10px);
dragPadding: margins(20px, 10px, 20px, 10px); dragPadding: margins(20px, 10px, 20px, 10px);

View file

@ -29,11 +29,11 @@ windowSubTextFg: #999999; // gray: fallback for subtext color
windowSubTextFgOver: #919191; // gray over light blue: fallback for subtext over color windowSubTextFgOver: #919191; // gray over light blue: fallback for subtext over color
windowBoldFg: #222222; // dark gray: fallback for bold text color windowBoldFg: #222222; // dark gray: fallback for bold text color
windowBoldFgOver: #222222; // dark gray: fallback for over bold text color windowBoldFgOver: #222222; // dark gray: fallback for over bold text color
windowBgActive: #40ace3; // bright blue: fallback for blue filled active areas windowBgActive: #40a7e3; // bright blue: fallback for blue filled active areas
windowFgActive: #ffffff; // text on bright blue: fallback for text on active areas windowFgActive: #ffffff; // text on bright blue: fallback for text on active areas
windowActiveTextFg: #2687bf; // online blue: fallback for active color windowActiveTextFg: #168acd; // online blue: fallback for active color
windowShadowFg: #000000; // black: fallback for shadow color windowShadowFg: #000000; // black: fallback for shadow color
windowShadowFgFallback: #cdcdcd; // gray: fallback for shadow without windowShadowFgFallback: #cdcdcd; // gray: fallback for shadow without opacity
imageBg: #000000; imageBg: #000000;
imageBgTransparent: #ffffff; imageBgTransparent: #ffffff;
@ -46,11 +46,12 @@ activeButtonFg: windowFgActive;
activeButtonFgOver: activeButtonFg; activeButtonFgOver: activeButtonFg;
activeButtonSecondaryFg: #cceeff; activeButtonSecondaryFg: #cceeff;
activeButtonSecondaryFgOver: activeButtonSecondaryFg; activeButtonSecondaryFgOver: activeButtonSecondaryFg;
activeLineFg: #37a1de;
lightButtonBg: windowBg; lightButtonBg: windowBg;
lightButtonBgOver: #e3f1fa; lightButtonBgOver: #e3f1fa;
lightButtonBgRipple: #c9e4f6; lightButtonBgRipple: #c9e4f6;
lightButtonFg: #2b99d5; lightButtonFg: windowActiveTextFg;
lightButtonFgOver: lightButtonFg; lightButtonFgOver: lightButtonFg;
attentionButtonFg: #d14e4e; attentionButtonFg: #d14e4e;
@ -139,15 +140,15 @@ dialogsNameFg: windowBoldFg;
dialogsChatIconFg: dialogsNameFg; dialogsChatIconFg: dialogsNameFg;
dialogsDateFg: windowSubTextFg; dialogsDateFg: windowSubTextFg;
dialogsTextFg: windowSubTextFg; dialogsTextFg: windowSubTextFg;
dialogsTextFgService: #4981af; dialogsTextFgService: windowActiveTextFg;
dialogsDraftFg: #dd4b39; dialogsDraftFg: #dd4b39;
dialogsVerifiedIconBg: #4abcf1; dialogsVerifiedIconBg: windowBgActive;
dialogsVerifiedIconFg: #ffffff; dialogsVerifiedIconFg: windowFgActive;
dialogsSendingIconFg: #c1c1c1; dialogsSendingIconFg: #c1c1c1;
dialogsSentIconFg: #5dc452; dialogsSentIconFg: #5dc452;
dialogsUnreadBg: windowBgActive; dialogsUnreadBg: windowBgActive;
dialogsUnreadBgMuted: #bbbbbb; dialogsUnreadBgMuted: #bbbbbb;
dialogsUnreadFg: #ffffff; dialogsUnreadFg: windowFgActive;
dialogsBgOver: windowBgOver; dialogsBgOver: windowBgOver;
dialogsNameFgOver: windowBoldFgOver; dialogsNameFgOver: windowBoldFgOver;

View file

@ -146,6 +146,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_intro_submit" = "SUBMIT"; "lng_intro_submit" = "SUBMIT";
"lng_photo_caption" = "Caption"; "lng_photo_caption" = "Caption";
"lng_photos_comment" = "Comment";
"lng_phone_ph" = "Your phone number"; "lng_phone_ph" = "Your phone number";
"lng_phone_title" = "Your Phone"; "lng_phone_title" = "Your Phone";

View file

@ -30,9 +30,9 @@ windowSubTextFg: #999999;
windowSubTextFgOver: #919191; windowSubTextFgOver: #919191;
windowBoldFg: #222222; windowBoldFg: #222222;
windowBoldFgOver: #222222; windowBoldFgOver: #222222;
windowBgActive: #40ace3; windowBgActive: #40a7e3;
windowFgActive: #ffffff; windowFgActive: #ffffff;
windowActiveTextFg: #2687bf; windowActiveTextFg: #168acd;
windowShadowFg: #000000; windowShadowFg: #000000;
windowShadowFgFallback: #cdcdcd; windowShadowFgFallback: #cdcdcd;
imageBg: #000000; imageBg: #000000;
@ -44,10 +44,11 @@ activeButtonFg: windowFgActive;
activeButtonFgOver: activeButtonFg; activeButtonFgOver: activeButtonFg;
activeButtonSecondaryFg: #cceeff; activeButtonSecondaryFg: #cceeff;
activeButtonSecondaryFgOver: activeButtonSecondaryFg; activeButtonSecondaryFgOver: activeButtonSecondaryFg;
activeLineFg: #37a1de;
lightButtonBg: windowBg; lightButtonBg: windowBg;
lightButtonBgOver: #e3f1fa; lightButtonBgOver: #e3f1fa;
lightButtonBgRipple: #c9e4f6; lightButtonBgRipple: #c9e4f6;
lightButtonFg: #2b99d5; lightButtonFg: windowActiveTextFg;
lightButtonFgOver: lightButtonFg; lightButtonFgOver: lightButtonFg;
attentionButtonFg: #d14e4e; attentionButtonFg: #d14e4e;
attentionButtonFgOver: #d14e4e; attentionButtonFgOver: #d14e4e;
@ -113,15 +114,15 @@ dialogsNameFg: windowBoldFg;
dialogsChatIconFg: dialogsNameFg; dialogsChatIconFg: dialogsNameFg;
dialogsDateFg: windowSubTextFg; dialogsDateFg: windowSubTextFg;
dialogsTextFg: windowSubTextFg; dialogsTextFg: windowSubTextFg;
dialogsTextFgService: #4981af; dialogsTextFgService: windowActiveTextFg;
dialogsDraftFg: #dd4b39; dialogsDraftFg: #dd4b39;
dialogsVerifiedIconBg: #4abcf1; dialogsVerifiedIconBg: windowBgActive;
dialogsVerifiedIconFg: #ffffff; dialogsVerifiedIconFg: windowFgActive;
dialogsSendingIconFg: #c1c1c1; dialogsSendingIconFg: #c1c1c1;
dialogsSentIconFg: #5dc452; dialogsSentIconFg: #5dc452;
dialogsUnreadBg: windowBgActive; dialogsUnreadBg: windowBgActive;
dialogsUnreadBgMuted: #bbbbbb; dialogsUnreadBgMuted: #bbbbbb;
dialogsUnreadFg: #ffffff; dialogsUnreadFg: windowFgActive;
dialogsBgOver: windowBgOver; dialogsBgOver: windowBgOver;
dialogsNameFgOver: windowBoldFgOver; dialogsNameFgOver: windowBoldFgOver;
dialogsChatIconFgOver: dialogsNameFgOver; dialogsChatIconFgOver: dialogsNameFgOver;

View file

@ -34,8 +34,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,10,19,10 FILEVERSION 0,10,19,11
PRODUCTVERSION 0,10,19,10 PRODUCTVERSION 0,10,19,11
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.19.10" VALUE "FileVersion", "0.10.19.11"
VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "LegalCopyright", "Copyright (C) 2014-2016"
VALUE "ProductName", "Telegram Desktop" VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "0.10.19.10" VALUE "ProductVersion", "0.10.19.11"
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,19,10 FILEVERSION 0,10,19,11
PRODUCTVERSION 0,10,19,10 PRODUCTVERSION 0,10,19,11
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.19.10" VALUE "FileVersion", "0.10.19.11"
VALUE "LegalCopyright", "Copyright (C) 2014-2016" VALUE "LegalCopyright", "Copyright (C) 2014-2016"
VALUE "ProductName", "Telegram Desktop" VALUE "ProductName", "Telegram Desktop"
VALUE "ProductVersion", "0.10.19.10" VALUE "ProductVersion", "0.10.19.11"
END END
END END
BLOCK "VarFileInfo" BLOCK "VarFileInfo"

View file

@ -1281,10 +1281,8 @@ void ApiWrap::gotWebPages(ChannelData *channel, const MTPmessages_Messages &msgs
} }
ApiWrap::~ApiWrap() { ApiWrap::~ApiWrap() {
App::clearHistories();
} }
void ApiWrap::stickerSetDisenableDone(const MTPmessages_StickerSetInstallResult &result, mtpRequestId req) { void ApiWrap::stickerSetDisenableDone(const MTPmessages_StickerSetInstallResult &result, mtpRequestId req) {
_stickerSetDisenableRequests.remove(req); _stickerSetDisenableRequests.remove(req);
if (_stickerSetDisenableRequests.isEmpty()) { if (_stickerSetDisenableRequests.isEmpty()) {

View file

@ -2165,11 +2165,12 @@ namespace {
int32 r = radius * cIntRetinaFactor(), s = st::msgShadow * cIntRetinaFactor(); int32 r = radius * cIntRetinaFactor(), s = st::msgShadow * cIntRetinaFactor();
QImage rect(r * 3, r * 3 + (shadow ? s : 0), QImage::Format_ARGB32_Premultiplied), localCors[4]; QImage rect(r * 3, r * 3 + (shadow ? s : 0), QImage::Format_ARGB32_Premultiplied), localCors[4];
{ {
QPainter p(&rect); Painter p(&rect);
PainterHighQualityEnabler hq(p);
p.setCompositionMode(QPainter::CompositionMode_Source); p.setCompositionMode(QPainter::CompositionMode_Source);
p.fillRect(QRect(0, 0, rect.width(), rect.height()), Qt::transparent); p.fillRect(QRect(0, 0, rect.width(), rect.height()), Qt::transparent);
p.setCompositionMode(QPainter::CompositionMode_SourceOver); p.setCompositionMode(QPainter::CompositionMode_SourceOver);
p.setRenderHint(QPainter::HighQualityAntialiasing);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
if (shadow) { if (shadow) {
p.setBrush((*shadow)->b); p.setBrush((*shadow)->b);

View file

@ -1094,6 +1094,7 @@ AppClass::~AppClass() {
Shortcuts::finish(); Shortcuts::finish();
delete base::take(_window); delete base::take(_window);
App::clearHistories();
Window::Notifications::finish(); Window::Notifications::finish();

View file

@ -275,9 +275,11 @@ GroupInfoBox::GroupInfoBox(CreatingGroupType creating, bool fromTypeChoose) : Ab
connect(_cancel, SIGNAL(clicked()), this, SLOT(onClose())); connect(_cancel, SIGNAL(clicked()), this, SLOT(onClose()));
_photo->setClickedCallback([this] { _photo->setClickedCallback([this] {
auto imgExtensions = cImgExtensions(); App::CallDelayed(st::defaultActiveButton.ripple.hideDuration, base::lambda_guarded(this, [this] {
auto filter = qsl("Image files (*") + imgExtensions.join(qsl(" *")) + qsl(");;") + filedialogAllFilesFilter(); auto imgExtensions = cImgExtensions();
_setPhotoFileQueryId = FileDialog::queryReadFile(lang(lng_choose_image), filter); auto filter = qsl("Image files (*") + imgExtensions.join(qsl(" *")) + qsl(");;") + filedialogAllFilesFilter();
_setPhotoFileQueryId = FileDialog::queryReadFile(lang(lng_choose_image), filter);
}));
}); });
subscribe(FileDialog::QueryDone(), [this](const FileDialog::QueryUpdate &update) { subscribe(FileDialog::QueryDone(), [this](const FileDialog::QueryUpdate &update) {
notifyFileQueryUpdated(update); notifyFileQueryUpdated(update);

View file

@ -344,7 +344,7 @@ sharePhotoCheckbox: RoundImageCheckbox(contactsPhotoCheckbox) {
} }
shareNameFont: font(11px); shareNameFont: font(11px);
shareNameFg: windowFg; shareNameFg: windowFg;
shareNameActiveFg: btnYesColor; shareNameActiveFg: windowActiveTextFg;
shareNameTop: 6px; shareNameTop: 6px;
shareColumnSkip: 6px; shareColumnSkip: 6px;
shareActivateDuration: 150; shareActivateDuration: 150;

View file

@ -1012,17 +1012,17 @@ void ContactsBox::Inner::paintDisabledCheckUserpic(Painter &p, PeerData *peer, i
peer->paintUserpicLeft(p, userpicRadius * 2, userpicLeft, userpicTop, width()); peer->paintUserpicLeft(p, userpicRadius * 2, userpicLeft, userpicTop, width());
p.setRenderHint(QPainter::HighQualityAntialiasing, true); {
PainterHighQualityEnabler hq(p);
p.setPen(userpicBorderPen); p.setPen(userpicBorderPen);
p.setBrush(Qt::NoBrush); p.setBrush(Qt::NoBrush);
p.drawEllipse(userpicEllipse); p.drawEllipse(userpicEllipse);
p.setPen(iconBorderPen); p.setPen(iconBorderPen);
p.setBrush(st::contactsPhotoDisabledCheckFg); p.setBrush(st::contactsPhotoDisabledCheckFg);
p.drawEllipse(iconEllipse); p.drawEllipse(iconEllipse);
}
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
st::contactsPhotoCheckbox.check.check.paint(p, iconEllipse.topLeft(), outerWidth); st::contactsPhotoCheckbox.check.check.paint(p, iconEllipse.topLeft(), outerWidth);
} }
@ -1071,10 +1071,10 @@ void ContactsBox::Inner::paintEvent(QPaintEvent *e) {
yTo -= _contacts->size() * _rowHeight; yTo -= _contacts->size() * _rowHeight;
} }
if (!_byUsername.isEmpty()) { if (!_byUsername.isEmpty()) {
p.fillRect(0, 0, width(), st::searchedBarHeight, st::searchedBarBG->b); p.fillRect(0, 0, width(), st::searchedBarHeight, st::searchedBarBg);
p.setFont(st::searchedBarFont->f); p.setFont(st::searchedBarFont);
p.setPen(st::searchedBarColor->p); p.setPen(st::searchedBarFg);
p.drawText(QRect(0, 0, width(), st::searchedBarHeight), lang(lng_search_global_results), style::al_center); p.drawTextLeft(st::searchedBarPosition.x(), st::searchedBarPosition.y(), width(), lang(lng_search_global_results), style::al_center);
yFrom -= st::searchedBarHeight; yFrom -= st::searchedBarHeight;
yTo -= st::searchedBarHeight; yTo -= st::searchedBarHeight;
@ -1135,10 +1135,10 @@ void ContactsBox::Inner::paintEvent(QPaintEvent *e) {
} }
} }
if (!_byUsernameFiltered.isEmpty()) { if (!_byUsernameFiltered.isEmpty()) {
p.fillRect(0, 0, width(), st::searchedBarHeight, st::searchedBarBG->b); p.fillRect(0, 0, width(), st::searchedBarHeight, st::searchedBarBg);
p.setFont(st::searchedBarFont->f); p.setFont(st::searchedBarFont);
p.setPen(st::searchedBarColor->p); p.setPen(st::searchedBarFg);
p.drawText(QRect(0, 0, width(), st::searchedBarHeight), lang(lng_search_global_results), style::al_center); p.drawTextLeft(st::searchedBarPosition.x(), st::searchedBarPosition.y(), width(), lang(lng_search_global_results), style::al_center);
p.translate(0, st::searchedBarHeight); p.translate(0, st::searchedBarHeight);
yFrom -= _filtered.size() * _rowHeight + st::searchedBarHeight; yFrom -= _filtered.size() * _rowHeight + st::searchedBarHeight;

View file

@ -221,8 +221,9 @@ void NotificationsBox::prepareNotificationSampleSmall() {
sampleImage.fill(st::notificationBg->c); sampleImage.fill(st::notificationBg->c);
{ {
Painter p(&sampleImage); Painter p(&sampleImage);
PainterHighQualityEnabler hq(p);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setRenderHint(QPainter::HighQualityAntialiasing);
auto padding = height / 8; auto padding = height / 8;
auto userpicSize = height - 2 * padding; auto userpicSize = height - 2 * padding;

View file

@ -245,7 +245,8 @@ void PhotoCropBox::paintEvent(QPaintEvent *e) {
_mask.fill(Qt::white); _mask.fill(Qt::white);
{ {
Painter p(&_mask); Painter p(&_mask);
p.setRenderHint(QPainter::HighQualityAntialiasing); PainterHighQualityEnabler hq(p);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(Qt::black); p.setBrush(Qt::black);
p.drawEllipse(_cropx, _cropy, _cropw, _cropw); p.drawEllipse(_cropx, _cropy, _cropw, _cropw);

View file

@ -124,7 +124,7 @@ SendFilesBox::SendFilesBox(const QString &filepath, QImage image, CompressConfir
SendFilesBox::SendFilesBox(const QStringList &files, CompressConfirm compressed) : AbstractBox(st::boxWideWidth) SendFilesBox::SendFilesBox(const QStringList &files, CompressConfirm compressed) : AbstractBox(st::boxWideWidth)
, _files(files) , _files(files)
, _compressConfirm(compressed) , _compressConfirm(compressed)
, _caption(this, st::confirmCaptionArea, lang(lng_photo_caption)) , _caption(this, st::confirmCaptionArea, lang(lng_photos_comment))
, _send(this, lang(lng_send_button), st::defaultBoxButton) , _send(this, lang(lng_send_button), st::defaultBoxButton)
, _cancel(this, lang(lng_cancel), st::cancelBoxButton) { , _cancel(this, lang(lng_cancel), st::cancelBoxButton) {
updateTitleText(); updateTitleText();
@ -245,9 +245,10 @@ void SendFilesBox::paintEvent(QPaintEvent *e) {
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(st::msgDateImgBg); p.setBrush(st::msgDateImgBg);
p.setRenderHint(QPainter::HighQualityAntialiasing); {
p.drawEllipse(inner); PainterHighQualityEnabler hq(p);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.drawEllipse(inner);
}
auto icon = &st::historyFileInPlay; auto icon = &st::historyFileInPlay;
icon->paintInCenter(p, inner); icon->paintInCenter(p, inner);
@ -279,9 +280,10 @@ void SendFilesBox::paintEvent(QPaintEvent *e) {
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(st::msgFileOutBg); p.setBrush(st::msgFileOutBg);
p.setRenderHint(QPainter::HighQualityAntialiasing); {
p.drawEllipse(inner); PainterHighQualityEnabler hq(p);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.drawEllipse(inner);
}
auto &icon = _fileIsImage ? st::historyFileOutImage : st::historyFileOutDocument; auto &icon = _fileIsImage ? st::historyFileOutImage : st::historyFileOutDocument;
icon.paintInCenter(p, inner); icon.paintInCenter(p, inner);
@ -541,10 +543,11 @@ void EditCaptionBox::paintEvent(QPaintEvent *e) {
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(st::msgDateImgBg); p.setBrush(st::msgDateImgBg);
p.setRenderHint(QPainter::HighQualityAntialiasing); {
p.drawEllipse(inner); PainterHighQualityEnabler hq(p);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.drawEllipse(inner);
}
auto icon = &st::historyFileInPlay; auto icon = &st::historyFileInPlay;
icon->paintInCenter(p, inner); icon->paintInCenter(p, inner);
} }
@ -580,9 +583,10 @@ void EditCaptionBox::paintEvent(QPaintEvent *e) {
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(st::msgFileInBg); p.setBrush(st::msgFileInBg);
p.setRenderHint(QPainter::HighQualityAntialiasing); {
p.drawEllipse(inner); PainterHighQualityEnabler hq(p);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.drawEllipse(inner);
}
auto icon = &(_isImage ? st::historyFileInImage : st::historyFileInDocument); auto icon = &(_isImage ? st::historyFileInImage : st::historyFileInDocument);
icon->paintInCenter(p, inner); icon->paintInCenter(p, inner);

View file

@ -720,9 +720,10 @@ void StickersBox::Inner::paintRow(Painter &p, int index, TimeMs ms) {
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(st::stickersFeaturedUnreadBg); p.setBrush(st::stickersFeaturedUnreadBg);
p.setRenderHint(QPainter::HighQualityAntialiasing, true); {
p.drawEllipse(rtlrect(namex + s->titleWidth + st::stickersFeaturedUnreadSkip, namey + st::stickersFeaturedUnreadTop, st::stickersFeaturedUnreadSize, st::stickersFeaturedUnreadSize, width())); PainterHighQualityEnabler hq(p);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.drawEllipse(rtlrect(namex + s->titleWidth + st::stickersFeaturedUnreadSkip, namey + st::stickersFeaturedUnreadTop, st::stickersFeaturedUnreadSize, st::stickersFeaturedUnreadSize, width()));
}
} }
p.setFont(st::contactsStatusFont); p.setFont(st::contactsStatusFont);

View file

@ -520,4 +520,26 @@ inline lambda_slot_wrap *lambda_slot(QObject *parent, lambda<void()> &&lambda) {
return new lambda_slot_wrap(parent, std_::move(lambda)); return new lambda_slot_wrap(parent, std_::move(lambda));
} }
class lambda_slot_once_wrap : public QObject {
Q_OBJECT
public:
lambda_slot_once_wrap(QObject *parent, lambda<void()> &&lambda) : QObject(parent), _lambda(std_::move(lambda)) {
}
public slots :
void action() {
_lambda();
delete this;
}
private:
lambda<void()> _lambda;
};
inline lambda_slot_once_wrap *lambda_slot_once(QObject *parent, lambda<void()> &&lambda) {
return new lambda_slot_once_wrap(parent, std_::move(lambda));
}
} // namespace base } // namespace base

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 (10019010ULL) #define BETA_VERSION_MACRO (10019011ULL)
constexpr int AppVersion = 10020; constexpr int AppVersion = 10020;
constexpr str_const AppVersionStr = "0.10.20"; constexpr str_const AppVersionStr = "0.10.20";

View file

@ -178,11 +178,11 @@ void DialogsInner::paintRegion(Painter &p, const QRegion &region, bool paintingO
} }
if (!_peopleResults.isEmpty()) { if (!_peopleResults.isEmpty()) {
p.fillRect(0, 0, fullWidth(), st::searchedBarHeight, st::searchedBarBG->b); p.fillRect(0, 0, fullWidth(), st::searchedBarHeight, st::searchedBarBg);
if (!paintingOther) { if (!paintingOther) {
p.setFont(st::searchedBarFont->f); p.setFont(st::searchedBarFont);
p.setPen(st::searchedBarColor->p); p.setPen(st::searchedBarFg);
p.drawText(QRect(0, 0, fullWidth(), st::searchedBarHeight), lang(lng_search_global_results), style::al_center); p.drawTextLeft(st::searchedBarPosition.x(), st::searchedBarPosition.y(), width(), lang(lng_search_global_results), style::al_center);
} }
p.translate(0, st::searchedBarHeight); p.translate(0, st::searchedBarHeight);
@ -207,11 +207,11 @@ void DialogsInner::paintRegion(Painter &p, const QRegion &region, bool paintingO
searchInPeerPaint(p, fullWidth(), paintingOther); searchInPeerPaint(p, fullWidth(), paintingOther);
p.translate(0, st::dialogsRowHeight); p.translate(0, st::dialogsRowHeight);
if (_state == FilteredState && _searchResults.isEmpty()) { if (_state == FilteredState && _searchResults.isEmpty()) {
p.fillRect(0, 0, fullWidth(), st::searchedBarHeight, st::searchedBarBG->b); p.fillRect(0, 0, fullWidth(), st::searchedBarHeight, st::searchedBarBg);
if (!paintingOther) { if (!paintingOther) {
p.setFont(st::searchedBarFont->f); p.setFont(st::searchedBarFont);
p.setPen(st::searchedBarColor->p); p.setPen(st::searchedBarFg);
p.drawText(QRect(0, 0, fullWidth(), st::searchedBarHeight), lang(lng_dlg_search_for_messages), style::al_center); p.drawTextLeft(st::searchedBarPosition.x(), st::searchedBarPosition.y(), width(), lang(lng_dlg_search_for_messages), style::al_center);
} }
p.translate(0, st::searchedBarHeight); p.translate(0, st::searchedBarHeight);
} }
@ -219,11 +219,11 @@ void DialogsInner::paintRegion(Painter &p, const QRegion &region, bool paintingO
if (_state == SearchedState || !_searchResults.isEmpty()) { if (_state == SearchedState || !_searchResults.isEmpty()) {
QString text = lng_search_found_results(lt_count, _searchResults.isEmpty() ? 0 : (_searchedMigratedCount + _searchedCount)); QString text = lng_search_found_results(lt_count, _searchResults.isEmpty() ? 0 : (_searchedMigratedCount + _searchedCount));
p.fillRect(0, 0, fullWidth(), st::searchedBarHeight, st::searchedBarBG->b); p.fillRect(0, 0, fullWidth(), st::searchedBarHeight, st::searchedBarBg);
if (!paintingOther) { if (!paintingOther) {
p.setFont(st::searchedBarFont->f); p.setFont(st::searchedBarFont);
p.setPen(st::searchedBarColor->p); p.setPen(st::searchedBarFg);
p.drawText(QRect(0, 0, fullWidth(), st::searchedBarHeight), text, style::al_center); p.drawTextLeft(st::searchedBarPosition.x(), st::searchedBarPosition.y(), width(), text, style::al_center);
} }
p.translate(0, st::searchedBarHeight); p.translate(0, st::searchedBarHeight);

View file

@ -38,8 +38,8 @@ Q_DECLARE_METATYPE(Ui::ShowWay);
namespace App { namespace App {
void LambdaDelayed(int duration, base::lambda<void()> &&lambda) { void CallDelayed(int duration, base::lambda<void()> &&lambda) {
QTimer::singleShot(duration, base::lambda_slot(App::app(), std_::move(lambda)), SLOT(action())); QTimer::singleShot(duration, base::lambda_slot_once(App::app(), std_::move(lambda)), SLOT(action()));
} }
void sendBotCommand(PeerData *peer, UserData *bot, const QString &cmd, MsgId replyTo) { void sendBotCommand(PeerData *peer, UserData *bot, const QString &cmd, MsgId replyTo) {

View file

@ -33,7 +33,7 @@ class ItemBase;
namespace App { namespace App {
void LambdaDelayed(int duration, base::lambda<void()> &&lambda); void CallDelayed(int duration, base::lambda<void()> &&lambda);
void sendBotCommand(PeerData *peer, UserData *bot, const QString &cmd, MsgId replyTo = 0); void sendBotCommand(PeerData *peer, UserData *bot, const QString &cmd, MsgId replyTo = 0);
bool insertBotCommand(const QString &cmd, bool specialGif = false); bool insertBotCommand(const QString &cmd, bool specialGif = false);

View file

@ -145,7 +145,7 @@ historyPeer3UserpicFg: #e4a861;
historyPeer3UserpicPerson: icon {{ size(120px, 120px), historyPeer3UserpicBg }, { "userpic_person", historyPeer3UserpicFg }}; historyPeer3UserpicPerson: icon {{ size(120px, 120px), historyPeer3UserpicBg }, { "userpic_person", historyPeer3UserpicFg }};
historyPeer3UserpicChat: icon {{ size(120px, 120px), historyPeer3UserpicBg }, { "userpic_chat", historyPeer3UserpicFg }}; historyPeer3UserpicChat: icon {{ size(120px, 120px), historyPeer3UserpicBg }, { "userpic_chat", historyPeer3UserpicFg }};
historyPeer3UserpicChannel: icon {{ size(120px, 120px), historyPeer3UserpicBg }, { "userpic_channel", historyPeer3UserpicFg }}; historyPeer3UserpicChannel: icon {{ size(120px, 120px), historyPeer3UserpicBg }, { "userpic_channel", historyPeer3UserpicFg }};
historyPeer4NameFg: #348cd4; // blue historyPeer4NameFg: windowActiveTextFg; // blue
historyPeer4UserpicBg: #8fbfe9; historyPeer4UserpicBg: #8fbfe9;
historyPeer4UserpicFg: #649fd3; historyPeer4UserpicFg: #649fd3;
historyPeer4UserpicPerson: icon {{ size(120px, 120px), historyPeer4UserpicBg }, { "userpic_person", historyPeer4UserpicFg }}; historyPeer4UserpicPerson: icon {{ size(120px, 120px), historyPeer4UserpicBg }, { "userpic_person", historyPeer4UserpicFg }};
@ -191,8 +191,8 @@ historySendRight: 2px;
historyComposeButton: FlatButton { historyComposeButton: FlatButton {
duration: 200; duration: 200;
color: btnYesColor; color: windowActiveTextFg;
overColor: btnYesHover; overColor: windowActiveTextFg;
bgColor: historyComposeButtonBg; bgColor: historyComposeButtonBg;
overBgColor: historyComposeButtonBgOver; overBgColor: historyComposeButtonBgOver;
@ -266,7 +266,7 @@ historyBotCommandStart: IconButton(historySend) {
} }
historyRecordVoiceFg: historyComposeIconFg; historyRecordVoiceFg: historyComposeIconFg;
historyRecordVoiceFgOver: historyComposeIconFgOver; historyRecordVoiceFgOver: historyComposeIconFgOver;
historyRecordVoiceFgActive: #58b2ed; historyRecordVoiceFgActive: windowBgActive;
historyRecordVoice: icon {{ "send_control_record", historyRecordVoiceFg }}; historyRecordVoice: icon {{ "send_control_record", historyRecordVoiceFg }};
historyRecordVoiceOver: icon {{ "send_control_record", historyRecordVoiceFgOver }}; historyRecordVoiceOver: icon {{ "send_control_record", historyRecordVoiceFgOver }};
historyRecordVoiceActive: icon {{ "send_control_record", historyRecordVoiceFgActive }}; historyRecordVoiceActive: icon {{ "send_control_record", historyRecordVoiceFgActive }};
@ -318,8 +318,8 @@ historyInlineBotCancel: IconButton(historyReplyCancel) {
reportSpamHide: FlatButton { reportSpamHide: FlatButton {
duration: 200; duration: 200;
color: btnYesColor; color: windowActiveTextFg;
overColor: btnYesHover; overColor: windowActiveTextFg;
bgColor: transparent; bgColor: transparent;
overBgColor: transparent; overBgColor: transparent;

View file

@ -393,23 +393,30 @@ void HistoryPhoto::draw(Painter &p, const QRect &r, TextSelection selection, Tim
} else { } else {
App::roundShadow(p, 0, 0, width, height, selected ? st::msgInShadowSelected : st::msgInShadow, selected ? InSelectedShadowCorners : InShadowCorners); App::roundShadow(p, 0, 0, width, height, selected ? st::msgInShadowSelected : st::msgInShadow, selected ? InSelectedShadowCorners : InShadowCorners);
} }
auto inWebPage = (_parent->getMedia() != this);
auto roundRadius = inWebPage ? ImageRoundRadius::Small : ImageRoundRadius::Large;
auto roundCorners = inWebPage ? ImageRoundCorner::All : ((isBubbleTop() ? (ImageRoundCorner::TopLeft | ImageRoundCorner::TopRight) : ImageRoundCorner::None)
| ((isBubbleBottom() && _caption.isEmpty()) ? (ImageRoundCorner::BottomLeft | ImageRoundCorner::BottomRight) : ImageRoundCorner::None));
QPixmap pix;
if (loaded) {
pix = _data->full->pixSingle(_pixw, _pixh, width, height, roundRadius, roundCorners);
} else {
pix = _data->thumb->pixBlurredSingle(_pixw, _pixh, width, height, roundRadius, roundCorners);
}
QRect rthumb(rtlrect(skipx, skipy, width, height, _width)); QRect rthumb(rtlrect(skipx, skipy, width, height, _width));
p.drawPixmap(rthumb.topLeft(), pix); QPixmap pix;
if (selected) { if (_parent->toHistoryMessage()) {
App::complexOverlayRect(p, rthumb, roundRadius, roundCorners); auto inWebPage = (_parent->getMedia() != this);
auto roundRadius = inWebPage ? ImageRoundRadius::Small : ImageRoundRadius::Large;
auto roundCorners = inWebPage ? ImageRoundCorner::All : ((isBubbleTop() ? (ImageRoundCorner::TopLeft | ImageRoundCorner::TopRight) : ImageRoundCorner::None)
| ((isBubbleBottom() && _caption.isEmpty()) ? (ImageRoundCorner::BottomLeft | ImageRoundCorner::BottomRight) : ImageRoundCorner::None));
if (loaded) {
pix = _data->full->pixSingle(_pixw, _pixh, width, height, roundRadius, roundCorners);
} else {
pix = _data->thumb->pixBlurredSingle(_pixw, _pixh, width, height, roundRadius, roundCorners);
}
p.drawPixmap(rthumb.topLeft(), pix);
if (selected) {
App::complexOverlayRect(p, rthumb, roundRadius, roundCorners);
}
} else {
if (loaded) {
pix = _data->full->pixCircled(_pixw, _pixh);
} else {
pix = _data->thumb->pixBlurredCircled(_pixw, _pixh);
}
p.drawPixmap(rthumb.topLeft(), pix);
} }
if (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);
@ -426,9 +433,10 @@ void HistoryPhoto::draw(Painter &p, const QRect &r, TextSelection selection, Tim
p.setOpacity(radialOpacity * p.opacity()); p.setOpacity(radialOpacity * p.opacity());
p.setRenderHint(QPainter::HighQualityAntialiasing); {
p.drawEllipse(inner); PainterHighQualityEnabler hq(p);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.drawEllipse(inner);
}
p.setOpacity(radial ? _animation->radial.opacity() : 1); p.setOpacity(radial ? _animation->radial.opacity() : 1);
@ -763,9 +771,10 @@ void HistoryVideo::draw(Painter &p, const QRect &r, TextSelection selection, Tim
p.setBrush(over ? st::msgDateImgBgOver : st::msgDateImgBg); p.setBrush(over ? st::msgDateImgBgOver : st::msgDateImgBg);
} }
p.setRenderHint(QPainter::HighQualityAntialiasing); {
p.drawEllipse(inner); PainterHighQualityEnabler hq(p);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.drawEllipse(inner);
}
if (!selected && _animation) { if (!selected && _animation) {
p.setOpacity(1); p.setOpacity(1);
@ -1123,9 +1132,10 @@ void HistoryDocument::draw(Painter &p, const QRect &r, TextSelection selection,
} }
p.setOpacity(radialOpacity * p.opacity()); p.setOpacity(radialOpacity * p.opacity());
p.setRenderHint(QPainter::HighQualityAntialiasing); {
p.drawEllipse(inner); PainterHighQualityEnabler hq(p);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.drawEllipse(inner);
}
p.setOpacity(radialOpacity); p.setOpacity(radialOpacity);
auto icon = ([radial, this, selected] { auto icon = ([radial, this, selected] {
@ -1170,9 +1180,10 @@ void HistoryDocument::draw(Painter &p, const QRect &r, TextSelection selection,
p.setBrush(outbg ? (over ? st::msgFileOutBgOver : st::msgFileOutBg) : (over ? st::msgFileInBgOver : st::msgFileInBg)); p.setBrush(outbg ? (over ? st::msgFileOutBgOver : st::msgFileOutBg) : (over ? st::msgFileInBgOver : st::msgFileInBg));
} }
p.setRenderHint(QPainter::HighQualityAntialiasing); {
p.drawEllipse(inner); PainterHighQualityEnabler hq(p);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.drawEllipse(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)));
@ -1279,9 +1290,10 @@ void HistoryDocument::draw(Painter &p, const QRect &r, TextSelection selection,
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(outbg ? (selected ? st::msgFileOutBgSelected : st::msgFileOutBg) : (selected ? st::msgFileInBgSelected : st::msgFileInBg)); p.setBrush(outbg ? (selected ? st::msgFileOutBgSelected : st::msgFileOutBg) : (selected ? st::msgFileInBgSelected : st::msgFileInBg));
p.setRenderHint(QPainter::HighQualityAntialiasing, true); {
p.drawEllipse(rtlrect(nameleft + w + st::mediaUnreadSkip, statustop + st::mediaUnreadTop, st::mediaUnreadSize, st::mediaUnreadSize, _width)); PainterHighQualityEnabler hq(p);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.drawEllipse(rtlrect(nameleft + w + st::mediaUnreadSkip, statustop + st::mediaUnreadTop, st::mediaUnreadSize, st::mediaUnreadSize, _width));
}
} }
} }
@ -1747,9 +1759,10 @@ void HistoryGif::draw(Painter &p, const QRect &r, TextSelection selection, TimeM
} }
p.setOpacity(radialOpacity * p.opacity()); p.setOpacity(radialOpacity * p.opacity());
p.setRenderHint(QPainter::HighQualityAntialiasing); {
p.drawEllipse(inner); PainterHighQualityEnabler hq(p);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.drawEllipse(inner);
}
p.setOpacity(radialOpacity); p.setOpacity(radialOpacity);
auto icon = ([this, radial, selected]() -> const style::icon * { auto icon = ([this, radial, selected]() -> const style::icon * {

View file

@ -338,9 +338,10 @@ void paintEmpty(Painter &p, int width, int height) {
auto position = QPoint((width - st::historyEmptySize) / 2, ((height - st::historyEmptySize) * 4) / 9); auto position = QPoint((width - st::historyEmptySize) / 2, ((height - st::historyEmptySize) * 4) / 9);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(st::msgServiceBg); p.setBrush(st::msgServiceBg);
p.setRenderHint(QPainter::HighQualityAntialiasing); {
p.drawEllipse(rtlrect(position.x(), position.y(), st::historyEmptySize, st::historyEmptySize, width)); PainterHighQualityEnabler hq(p);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.drawEllipse(rtlrect(position.x(), position.y(), st::historyEmptySize, st::historyEmptySize, width));
}
st::historyEmptyDog.paint(p, position.x() + (st::historyEmptySize - st::historyEmptyDog.width()) / 2, position.y() + (st::historyEmptySize - st::historyEmptyDog.height()) / 2, width); st::historyEmptyDog.paint(p, position.x() + (st::historyEmptySize - st::historyEmptyDog.width()) / 2, position.y() + (st::historyEmptySize - st::historyEmptyDog.height()) / 2, width);
} }

View file

@ -3102,7 +3102,7 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent)
} }
_attachToggle->setClickedCallback([this] { _attachToggle->setClickedCallback([this] {
App::LambdaDelayed(st::historyAttach.ripple.hideDuration, base::lambda_guarded(this, [this] { App::CallDelayed(st::historyAttach.ripple.hideDuration, base::lambda_guarded(this, [this] {
chooseAttach(); chooseAttach();
})); }));
}); });
@ -8736,11 +8736,13 @@ void HistoryWidget::drawRecordButton(Painter &p) {
void HistoryWidget::drawRecording(Painter &p) { void HistoryWidget::drawRecording(Painter &p) {
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(st::historyRecordSignalColor); p.setBrush(st::historyRecordSignalColor);
p.setRenderHint(QPainter::HighQualityAntialiasing);
float64 delta = qMin(float64(a_recordingLevel.current()) / 0x4000, 1.); float64 delta = qMin(float64(a_recordingLevel.current()) / 0x4000, 1.);
int32 d = 2 * qRound(st::historyRecordSignalMin + (delta * (st::historyRecordSignalMax - st::historyRecordSignalMin))); int32 d = 2 * qRound(st::historyRecordSignalMin + (delta * (st::historyRecordSignalMax - st::historyRecordSignalMin)));
p.drawEllipse(_attachToggle->x() + (_attachEmoji->width() - d) / 2, _attachToggle->y() + (_attachToggle->height() - d) / 2, d, d); {
p.setRenderHint(QPainter::HighQualityAntialiasing, false); PainterHighQualityEnabler hq(p);
p.drawEllipse(_attachToggle->x() + (_attachEmoji->width() - d) / 2, _attachToggle->y() + (_attachToggle->height() - d) / 2, d, d);
}
QString duration = formatDurationText(_recordingSamples / AudioVoiceMsgFrequency); QString duration = formatDurationText(_recordingSamples / AudioVoiceMsgFrequency);
p.setFont(st::historyRecordFont); p.setFont(st::historyRecordFont);
@ -8834,15 +8836,12 @@ void HistoryWidget::paintEvent(QPaintEvent *e) {
} }
} }
} else { } else {
bool smooth = p.renderHints().testFlag(QPainter::SmoothPixmapTransform); PainterHighQualityEnabler hq(p);
p.setRenderHint(QPainter::SmoothPixmapTransform);
QRect to, from; QRect to, from;
App::main()->backgroundParams(fill, to, from); App::main()->backgroundParams(fill, to, from);
to.moveTop(to.top() + fromy); to.moveTop(to.top() + fromy);
p.drawPixmap(to, pix, from); p.drawPixmap(to, pix, from);
if (!smooth) p.setRenderHint(QPainter::SmoothPixmapTransform, false);
} }
} else { } else {
p.drawPixmap(x, fromy + y, cached); p.drawPixmap(x, fromy + y, cached);

View file

@ -716,9 +716,10 @@ void File::paint(Painter &p, const QRect &clip, const PaintContext *context) con
p.setBrush(over ? st::msgFileInBgOver : st::msgFileInBg); p.setBrush(over ? st::msgFileInBgOver : st::msgFileInBg);
} }
p.setRenderHint(QPainter::HighQualityAntialiasing); {
p.drawEllipse(inner); PainterHighQualityEnabler hq(p);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.drawEllipse(inner);
}
if (radial) { if (radial) {
auto radialCircle = inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine)); auto radialCircle = inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine));

View file

@ -43,9 +43,11 @@ SignupWidget::SignupWidget(QWidget *parent, Widget::Data *data) : Step(parent, d
connect(_checkRequest, SIGNAL(timeout()), this, SLOT(onCheckRequest())); connect(_checkRequest, SIGNAL(timeout()), this, SLOT(onCheckRequest()));
_photo->setClickedCallback([this] { _photo->setClickedCallback([this] {
auto imgExtensions = cImgExtensions(); App::CallDelayed(st::defaultActiveButton.ripple.hideDuration, base::lambda_guarded(this, [this] {
auto filter = qsl("Image files (*") + imgExtensions.join(qsl(" *")) + qsl(");;") + filedialogAllFilesFilter(); auto imgExtensions = cImgExtensions();
_readPhotoFileQueryId = FileDialog::queryReadFile(lang(lng_choose_image), filter); auto filter = qsl("Image files (*") + imgExtensions.join(qsl(" *")) + qsl(");;") + filedialogAllFilesFilter();
_readPhotoFileQueryId = FileDialog::queryReadFile(lang(lng_choose_image), filter);
}));
}); });
subscribe(FileDialog::QueryDone(), [this](const FileDialog::QueryUpdate &update) { subscribe(FileDialog::QueryDone(), [this](const FileDialog::QueryUpdate &update) {
notifyFileQueryUpdated(update); notifyFileQueryUpdated(update);

View file

@ -218,6 +218,7 @@ void MainWindow::clearWidgets() {
hideMediaview(); hideMediaview();
_mediaView->rpcClear(); _mediaView->rpcClear();
} }
App::clearHistories();
updateGlobalMenu(); updateGlobalMenu();
} }
@ -1492,7 +1493,7 @@ PreLaunchWindow::PreLaunchWindow(QString title) : TWidget(0) {
int paddingVertical = (_size / 2); int paddingVertical = (_size / 2);
int paddingHorizontal = _size; int paddingHorizontal = _size;
int borderRadius = (_size / 5); int borderRadius = (_size / 5);
setStyleSheet(qsl("QPushButton { padding: %1px %2px; background-color: #ffffff; border-radius: %3px; }\nQPushButton#confirm:hover, QPushButton#cancel:hover { background-color: #e3f1fa; color: #2f9fea; }\nQPushButton#confirm { color: #2f9fea; }\nQPushButton#cancel { color: #aeaeae; }\nQLineEdit { border: 1px solid #e0e0e0; padding: 5px; }\nQLineEdit:focus { border: 2px solid #62c0f7; padding: 4px; }").arg(paddingVertical).arg(paddingHorizontal).arg(borderRadius)); setStyleSheet(qsl("QPushButton { padding: %1px %2px; background-color: #ffffff; border-radius: %3px; }\nQPushButton#confirm:hover, QPushButton#cancel:hover { background-color: #e3f1fa; color: #2f9fea; }\nQPushButton#confirm { color: #2f9fea; }\nQPushButton#cancel { color: #aeaeae; }\nQLineEdit { border: 1px solid #e0e0e0; padding: 5px; }\nQLineEdit:focus { border: 2px solid #37a1de; padding: 4px; }").arg(paddingVertical).arg(paddingHorizontal).arg(borderRadius));
if (!PreLaunchWindowInstance) { if (!PreLaunchWindowInstance) {
PreLaunchWindowInstance = this; PreLaunchWindowInstance = this;
} }

View file

@ -111,8 +111,9 @@ void PlayButtonLayout::paintPlay(Painter &p, const QBrush &brush) {
auto playWidth = _st.playOuter.width() - 2 * playLeft; auto playWidth = _st.playOuter.width() - 2 * playLeft;
auto playHeight = _st.playOuter.height() - 2 * playTop; auto playHeight = _st.playOuter.height() - 2 * playTop;
PainterHighQualityEnabler hq(p);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setRenderHint(QPainter::HighQualityAntialiasing, true);
QPainterPath pathPlay; QPainterPath pathPlay;
pathPlay.moveTo(playLeft, playTop); pathPlay.moveTo(playLeft, playTop);
@ -120,8 +121,6 @@ void PlayButtonLayout::paintPlay(Painter &p, const QBrush &brush) {
pathPlay.lineTo(playLeft, playTop + playHeight); pathPlay.lineTo(playLeft, playTop + playHeight);
pathPlay.lineTo(playLeft, playTop); pathPlay.lineTo(playLeft, playTop);
p.fillPath(pathPlay, brush); p.fillPath(pathPlay, brush);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
} }
void PlayButtonLayout::paintPlayToPause(Painter &p, const QBrush &brush, float64 progress) { void PlayButtonLayout::paintPlayToPause(Painter &p, const QBrush &brush, float64 progress) {
@ -137,7 +136,7 @@ void PlayButtonLayout::paintPlayToPause(Painter &p, const QBrush &brush, float64
auto pauseStroke = 0. + _st.pauseStroke; auto pauseStroke = 0. + _st.pauseStroke;
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setRenderHint(QPainter::HighQualityAntialiasing, true); PainterHighQualityEnabler hq(p);
QPointF pathLeftPause[] = { QPointF pathLeftPause[] = {
{ pauseLeft, pauseTop }, { pauseLeft, pauseTop },
@ -166,8 +165,6 @@ void PlayButtonLayout::paintPlayToPause(Painter &p, const QBrush &brush, float64
{ playLeft + (playWidth / 2.), playTop + (3 * playHeight / 4.) }, { playLeft + (playWidth / 2.), playTop + (3 * playHeight / 4.) },
}; };
p.fillPath(interpolatePaths(pathRightPlay, pathRightPause, progress), brush); p.fillPath(interpolatePaths(pathRightPlay, pathRightPause, progress), brush);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
} }
void PlayButtonLayout::paintPlayToCancel(Painter &p, const QBrush &brush, float64 progress) { void PlayButtonLayout::paintPlayToCancel(Painter &p, const QBrush &brush, float64 progress) {
@ -185,7 +182,7 @@ void PlayButtonLayout::paintPlayToCancel(Painter &p, const QBrush &brush, float6
auto cancelStroke = (0. + _st.cancelStroke) / sqrt2; auto cancelStroke = (0. + _st.cancelStroke) / sqrt2;
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setRenderHint(QPainter::HighQualityAntialiasing, true); PainterHighQualityEnabler hq(p);
QPointF pathPlay[] = { QPointF pathPlay[] = {
{ playLeft, playTop }, { playLeft, playTop },
@ -216,8 +213,6 @@ void PlayButtonLayout::paintPlayToCancel(Painter &p, const QBrush &brush, float6
{ cancelLeft + (cancelWidth / 2.) - cancelStroke, cancelTop + (cancelHeight / 2.) }, { cancelLeft + (cancelWidth / 2.) - cancelStroke, cancelTop + (cancelHeight / 2.) },
}; };
p.fillPath(interpolatePaths(pathPlay, pathCancel, progress), brush); p.fillPath(interpolatePaths(pathPlay, pathCancel, progress), brush);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
} }
void PlayButtonLayout::paintPauseToCancel(Painter &p, const QBrush &brush, float64 progress) { void PlayButtonLayout::paintPauseToCancel(Painter &p, const QBrush &brush, float64 progress) {
@ -236,7 +231,7 @@ void PlayButtonLayout::paintPauseToCancel(Painter &p, const QBrush &brush, float
auto cancelStroke = (0. + _st.cancelStroke) / sqrt2; auto cancelStroke = (0. + _st.cancelStroke) / sqrt2;
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setRenderHint(QPainter::HighQualityAntialiasing, true); PainterHighQualityEnabler hq(p);
QPointF pathLeftPause[] = { QPointF pathLeftPause[] = {
{ pauseLeft, pauseTop }, { pauseLeft, pauseTop },
@ -265,8 +260,6 @@ void PlayButtonLayout::paintPauseToCancel(Painter &p, const QBrush &brush, float
{ cancelLeft, cancelTop + cancelHeight - cancelStroke }, { cancelLeft, cancelTop + cancelHeight - cancelStroke },
}; };
p.fillPath(interpolatePaths(pathRightPause, pathRightCancel, progress), brush); p.fillPath(interpolatePaths(pathRightPause, pathRightCancel, progress), brush);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
} }
void PlayButtonLayout::animationCallback() { void PlayButtonLayout::animationCallback() {

View file

@ -1568,10 +1568,8 @@ void MediaView::paintEvent(QPaintEvent *e) {
p.fillRect(imgRect, _transparentBrush); p.fillRect(imgRect, _transparentBrush);
} }
if (toDraw.width() != _w * cIntRetinaFactor()) { if (toDraw.width() != _w * cIntRetinaFactor()) {
bool was = (p.renderHints() & QPainter::SmoothPixmapTransform); PainterHighQualityEnabler hq(p);
if (!was) p.setRenderHint(QPainter::SmoothPixmapTransform, true);
p.drawPixmap(QRect(_x, _y, _w, _h), toDraw); p.drawPixmap(QRect(_x, _y, _w, _h), toDraw);
if (!was) p.setRenderHint(QPainter::SmoothPixmapTransform, false);
} else { } else {
p.drawPixmap(_x, _y, toDraw); p.drawPixmap(_x, _y, toDraw);
} }
@ -1591,9 +1589,10 @@ void MediaView::paintEvent(QPaintEvent *e) {
p.setOpacity(radialOpacity); p.setOpacity(radialOpacity);
p.setBrush(st::radialBg); p.setBrush(st::radialBg);
p.setRenderHint(QPainter::HighQualityAntialiasing); {
p.drawEllipse(inner); PainterHighQualityEnabler hq(p);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.drawEllipse(inner);
}
p.setOpacity(1); p.setOpacity(1);
QRect arc(inner.marginsRemoved(QMargins(st::radialLine, st::radialLine, st::radialLine, st::radialLine))); QRect arc(inner.marginsRemoved(QMargins(st::radialLine, st::radialLine, st::radialLine, st::radialLine)));
@ -1807,9 +1806,10 @@ void MediaView::paintDocRadialLoading(Painter &p, bool radial, float64 radialOpa
p.setOpacity(_doc->loaded() ? radialOpacity : 1.); p.setOpacity(_doc->loaded() ? radialOpacity : 1.);
p.setBrush(anim::brush(st::msgDateImgBg, st::msgDateImgBgOver, o)); p.setBrush(anim::brush(st::msgDateImgBg, st::msgDateImgBgOver, o));
p.setRenderHint(QPainter::HighQualityAntialiasing); {
p.drawEllipse(inner); PainterHighQualityEnabler hq(p);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.drawEllipse(inner);
}
p.setOpacity(1.); p.setOpacity(1.);
auto icon = ([radial, this]() -> const style::icon* { auto icon = ([radial, this]() -> const style::icon* {

View file

@ -63,7 +63,7 @@ overviewPhotoSelectOverlay: #40ace333;
overviewVideoBg: #000000; overviewVideoBg: #000000;
overviewFileThumbBg: #000000; overviewFileThumbBg: #000000;
overviewFileChecked: #2fa9e2; overviewFileChecked: windowBgActive;
overviewFileCheck: #00000066; overviewFileCheck: #00000066;
overviewFileExtPadding: 5px; overviewFileExtPadding: 5px;
overviewFileExtTop: 24px; overviewFileExtTop: 24px;

View file

@ -402,9 +402,10 @@ void Video::paint(Painter &p, const QRect &clip, TextSelection selection, const
p.setBrush(over ? st::msgDateImgBgOver : st::msgDateImgBg); p.setBrush(over ? st::msgDateImgBgOver : st::msgDateImgBg);
} }
p.setRenderHint(QPainter::HighQualityAntialiasing); {
p.drawEllipse(inner); PainterHighQualityEnabler hq(p);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.drawEllipse(inner);
}
p.setOpacity((radial && loaded) ? _radial->opacity() : 1); p.setOpacity((radial && loaded) ? _radial->opacity() : 1);
auto icon = ([radial, loaded, selected] { auto icon = ([radial, loaded, selected] {
@ -549,9 +550,10 @@ void Voice::paint(Painter &p, const QRect &clip, TextSelection selection, const
p.setBrush(over ? st::msgFileInBgOver : st::msgFileInBg); p.setBrush(over ? st::msgFileInBgOver : st::msgFileInBg);
} }
p.setRenderHint(QPainter::HighQualityAntialiasing); {
p.drawEllipse(inner); PainterHighQualityEnabler hq(p);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.drawEllipse(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)));
@ -597,9 +599,10 @@ void Voice::paint(Painter &p, const QRect &clip, TextSelection selection, const
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(selected ? st::msgFileInBgSelected : st::msgFileInBg); p.setBrush(selected ? st::msgFileInBgSelected : st::msgFileInBg);
p.setRenderHint(QPainter::HighQualityAntialiasing, true); {
p.drawEllipse(rtlrect(unreadx + st::mediaUnreadSkip, statustop + st::mediaUnreadTop, st::mediaUnreadSize, st::mediaUnreadSize, _width)); PainterHighQualityEnabler hq(p);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.drawEllipse(rtlrect(unreadx + st::mediaUnreadSkip, statustop + st::mediaUnreadTop, st::mediaUnreadSize, st::mediaUnreadSize, _width));
}
} }
} }
} }
@ -758,9 +761,10 @@ void Document::paint(Painter &p, const QRect &clip, TextSelection selection, con
p.setBrush(over ? _st.songOverBg : _st.songIconBg); p.setBrush(over ? _st.songOverBg : _st.songIconBg);
} }
p.setRenderHint(QPainter::HighQualityAntialiasing); {
p.drawEllipse(inner); PainterHighQualityEnabler hq(p);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.drawEllipse(inner);
}
if (radial) { if (radial) {
auto rinner = inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine)); auto rinner = inner.marginsRemoved(QMargins(st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine, st::msgFileRadialLine));
@ -834,9 +838,10 @@ void Document::paint(Painter &p, const QRect &clip, TextSelection selection, con
} }
p.setOpacity(radialOpacity * p.opacity()); p.setOpacity(radialOpacity * p.opacity());
p.setRenderHint(QPainter::HighQualityAntialiasing); {
p.drawEllipse(inner); PainterHighQualityEnabler hq(p);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.drawEllipse(inner);
}
p.setOpacity(radialOpacity); p.setOpacity(radialOpacity);
auto icon = ([loaded, this, selected] { auto icon = ([loaded, this, selected] {
@ -1187,7 +1192,7 @@ void Link::paint(Painter &p, const QRect &clip, TextSelection selection, const P
top += h; top += h;
} }
p.setPen(st::btnYesColor); p.setPen(st::windowActiveTextFg);
for (int32 i = 0, l = _links.size(); i < l; ++i) { for (int32 i = 0, l = _links.size(); i < l; ++i) {
if (clip.intersects(rtlrect(left, top, qMin(w, _links.at(i).width), st::normalFont->height, _width))) { if (clip.intersects(rtlrect(left, top, qMin(w, _links.at(i).width), st::normalFont->height, _width))) {
p.setFont(ClickHandler::showAsActive(_links.at(i).lnk) ? st::normalFont->underline() : st::normalFont); p.setFont(ClickHandler::showAsActive(_links.at(i).lnk) ? st::normalFont->underline() : st::normalFont);

View file

@ -125,7 +125,7 @@ profileMemberStatusPosition: point(68px, 31px);
profileMemberStatusFg: windowSubTextFg; profileMemberStatusFg: windowSubTextFg;
profileMemberStatusFgOver: windowSubTextFgOver; profileMemberStatusFgOver: windowSubTextFgOver;
profileMemberStatusFgActive: windowActiveTextFg; profileMemberStatusFgActive: windowActiveTextFg;
profileMemberAdminIcon: icon {{ "profile_admin_star", #3babe7, point(4px, 3px) }}; profileMemberAdminIcon: icon {{ "profile_admin_star", windowBgActive, point(4px, 3px) }};
profileLimitReachedLabel: FlatLabel(defaultFlatLabel) { profileLimitReachedLabel: FlatLabel(defaultFlatLabel) {
width: 180px; width: 180px;
margin: margins(profileMemberPaddingLeft, 9px, profileMemberPaddingLeft, 6px); margin: margins(profileMemberPaddingLeft, 9px, profileMemberPaddingLeft, 6px);
@ -141,6 +141,6 @@ profileReportReasonOther: InputArea(defaultInputArea) {
profileVerifiedCheckShift: -3px; profileVerifiedCheckShift: -3px;
profileVerifiedCheck: icon { profileVerifiedCheck: icon {
{ "profile_verified_star", #4abcf1, point(0px, 7px) }, { "profile_verified_star", windowBgActive, point(0px, 7px) },
{ "profile_verified_check", #ffffff, point(4px, 11px) } { "profile_verified_check", windowFgActive, point(4px, 11px) }
}; };

View file

@ -69,9 +69,10 @@ void BackgroundRow::paintEvent(QPaintEvent *e) {
p.setOpacity(radialOpacity); p.setOpacity(radialOpacity);
p.setBrush(st::radialBg); p.setBrush(st::radialBg);
p.setRenderHint(QPainter::HighQualityAntialiasing); {
p.drawEllipse(inner); PainterHighQualityEnabler hq(p);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.drawEllipse(inner);
}
p.setOpacity(1); p.setOpacity(1);
QRect arc(inner.marginsRemoved(QMargins(st::radialLine, st::radialLine, st::radialLine, st::radialLine))); QRect arc(inner.marginsRemoved(QMargins(st::radialLine, st::radialLine, st::radialLine, st::radialLine)));
@ -143,12 +144,13 @@ void BackgroundRow::updateImage() {
QImage back(size, size, QImage::Format_ARGB32_Premultiplied); QImage back(size, size, QImage::Format_ARGB32_Premultiplied);
back.setDevicePixelRatio(cRetinaFactor()); back.setDevicePixelRatio(cRetinaFactor());
{ {
QPainter p(&back); Painter p(&back);
PainterHighQualityEnabler hq(p);
auto &pix = Window::Theme::Background()->image(); auto &pix = Window::Theme::Background()->image();
int sx = (pix.width() > pix.height()) ? ((pix.width() - pix.height()) / 2) : 0; int sx = (pix.width() > pix.height()) ? ((pix.width() - pix.height()) / 2) : 0;
int sy = (pix.height() > pix.width()) ? ((pix.height() - pix.width()) / 2) : 0; int sy = (pix.height() > pix.width()) ? ((pix.height() - pix.width()) / 2) : 0;
int s = (pix.width() > pix.height()) ? pix.height() : pix.width(); int s = (pix.width() > pix.height()) ? pix.height() : pix.width();
p.setRenderHint(QPainter::SmoothPixmapTransform);
p.drawPixmap(0, 0, st::settingsBackgroundSize, st::settingsBackgroundSize, pix, sx, sy, s, s); p.drawPixmap(0, 0, st::settingsBackgroundSize, st::settingsBackgroundSize, pix, sx, sy, s, s);
} }
Images::prepareRound(back, ImageRoundRadius::Small); Images::prepareRound(back, ImageRoundRadius::Small);

View file

@ -69,6 +69,8 @@ CoverWidget::CoverWidget(QWidget *parent, UserData *self) : BlockWidget(parent,
validatePhoto(); validatePhoto();
refreshNameText(); refreshNameText();
subscribe(Global::RefConnectionTypeChanged(), [this] { refreshStatusText(); });
refreshStatusText(); refreshStatusText();
} }
@ -290,8 +292,14 @@ void CoverWidget::refreshStatusText() {
} }
_cancelPhotoUpload.destroy(); _cancelPhotoUpload.destroy();
_statusText = lang(lng_status_online); auto state = MTP::dcstate();
_statusTextIsOnline = true; if (state == MTP::ConnectingState || state == MTP::DisconnectedState || state < 0) {
_statusText = lang(lng_status_connecting);
_statusTextIsOnline = false;
} else {
_statusText = lang(lng_status_online);
_statusTextIsOnline = true;
}
update(); update();
} }

View file

@ -127,7 +127,7 @@ void ScaleWidget::onRestartNow() {
} }
void ScaleWidget::onCancel() { void ScaleWidget::onCancel() {
App::LambdaDelayed(st::boxDuration, base::lambda_guarded(this, [this] { App::CallDelayed(st::boxDuration, base::lambda_guarded(this, [this] {
setScale(cRealScale()); setScale(cRealScale());
})); }));
} }

View file

@ -994,9 +994,10 @@ void StickerPanInner::paintStickers(Painter &p, const QRect &r) {
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(st::stickersFeaturedUnreadBg); p.setBrush(st::stickersFeaturedUnreadBg);
p.setRenderHint(QPainter::HighQualityAntialiasing, true); {
p.drawEllipse(rtlrect(st::emojiPanHeaderLeft - st::buttonRadius + titleWidth + st::stickersFeaturedUnreadSkip, y + st::stickersTrendingHeaderTop + st::stickersFeaturedUnreadTop, st::stickersFeaturedUnreadSize, st::stickersFeaturedUnreadSize, width())); PainterHighQualityEnabler hq(p);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.drawEllipse(rtlrect(st::emojiPanHeaderLeft - st::buttonRadius + titleWidth + st::stickersFeaturedUnreadSkip, y + st::stickersTrendingHeaderTop + st::stickersFeaturedUnreadTop, st::stickersFeaturedUnreadSize, st::stickersFeaturedUnreadSize, width()));
}
} }
p.setFont(st::stickersTrendingSubheaderFont); p.setFont(st::stickersTrendingSubheaderFont);

View file

@ -94,9 +94,11 @@ stickersReorderFg: #777777;
stickersRowDisabledOpacity: 0.4; stickersRowDisabledOpacity: 0.4;
stickersRowDuration: 200; stickersRowDuration: 200;
stickersSettings: icon {{ "emoji_settings", #b3b3b3 }}; emojiIconFg: #b3b3b3;
stickersTrending: icon {{ "emoji_trending", #b3b3b3 }}; emojiIconFgActive: windowBgActive;
stickersTrendingActive: icon {{ "emoji_trending", #58b2ed }}; stickersSettings: icon {{ "emoji_settings", emojiIconFg }};
stickersTrending: icon {{ "emoji_trending", emojiIconFg }};
stickersTrendingActive: icon {{ "emoji_trending", emojiIconFgActive }};
stickersSettingsUnreadSize: 17px; stickersSettingsUnreadSize: 17px;
stickersSettingsUnreadPosition: point(4px, 5px); stickersSettingsUnreadPosition: point(4px, 5px);
@ -104,24 +106,24 @@ stickersSettingsUnreadPosition: point(4px, 5px);
emojiScroll: FlatScroll(defaultSolidScroll) { emojiScroll: FlatScroll(defaultSolidScroll) {
deltat: 48px; deltat: 48px;
} }
emojiRecent: icon {{ "emoji_recent", #b3b3b3 }}; emojiRecent: icon {{ "emoji_recent", emojiIconFg }};
emojiRecentActive: icon {{ "emoji_recent", #58b2ed }}; emojiRecentActive: icon {{ "emoji_recent", emojiIconFgActive }};
emojiPeople: icon {{ "emoji_people", #b3b3b3 }}; emojiPeople: icon {{ "emoji_people", emojiIconFg }};
emojiPeopleActive: icon {{ "emoji_people", #58b2ed }}; emojiPeopleActive: icon {{ "emoji_people", emojiIconFgActive }};
emojiNature: icon {{ "emoji_nature", #b3b3b3 }}; emojiNature: icon {{ "emoji_nature", emojiIconFg }};
emojiNatureActive: icon {{ "emoji_nature", #58b2ed }}; emojiNatureActive: icon {{ "emoji_nature", emojiIconFgActive }};
emojiFood: icon {{ "emoji_food", #b3b3b3 }}; emojiFood: icon {{ "emoji_food", emojiIconFg }};
emojiFoodActive: icon {{ "emoji_food", #58b2ed }}; emojiFoodActive: icon {{ "emoji_food", emojiIconFgActive }};
emojiActivity: icon {{ "emoji_activity", #b3b3b3 }}; emojiActivity: icon {{ "emoji_activity", emojiIconFg }};
emojiActivityActive: icon {{ "emoji_activity", #58b2ed }}; emojiActivityActive: icon {{ "emoji_activity", emojiIconFgActive }};
emojiTravel: icon {{ "emoji_travel", #b3b3b3 }}; emojiTravel: icon {{ "emoji_travel", emojiIconFg }};
emojiTravelActive: icon {{ "emoji_travel", #58b2ed }}; emojiTravelActive: icon {{ "emoji_travel", emojiIconFgActive }};
emojiObjects: icon {{ "emoji_objects", #b3b3b3 }}; emojiObjects: icon {{ "emoji_objects", emojiIconFg }};
emojiObjectsActive: icon {{ "emoji_objects", #58b2ed }}; emojiObjectsActive: icon {{ "emoji_objects", emojiIconFgActive }};
emojiSymbols: icon {{ "emoji_symbols", #b3b3b3 }}; emojiSymbols: icon {{ "emoji_symbols", emojiIconFg }};
emojiSymbolsActive: icon {{ "emoji_symbols", #58b2ed }}; emojiSymbolsActive: icon {{ "emoji_symbols", emojiIconFgActive }};
emojiSavedGifs: icon {{ "emoji_gif", #b3b3b3 }}; emojiSavedGifs: icon {{ "emoji_gif", emojiIconFg }};
emojiSavedGifsActive: icon {{ "emoji_gif", #58b2ed }}; emojiSavedGifsActive: icon {{ "emoji_gif", emojiIconFgActive }};
emojiCategory: IconButton { emojiCategory: IconButton {
width: 42px; width: 42px;
@ -161,7 +163,7 @@ emojiColorsSepColor: #d5d5d5;
emojiSwitchSkip: 27px; emojiSwitchSkip: 27px;
emojiSwitchImgSkip: 21px; emojiSwitchImgSkip: 21px;
emojiSwitchColor: #42a8db; emojiSwitchColor: windowActiveTextFg;
emojiSwitchStickers: icon {{ "emoji_switch", emojiSwitchColor }}; emojiSwitchStickers: icon {{ "emoji_switch", emojiSwitchColor }};
emojiSwitchEmoji: icon {{ "emoji_switch-flip_horizontal", emojiSwitchColor }}; emojiSwitchEmoji: icon {{ "emoji_switch-flip_horizontal", emojiSwitchColor }};
@ -175,7 +177,7 @@ stickerPanDeleteOpacity: 0.5;
stickerIconPadding: 5px; stickerIconPadding: 5px;
stickerIconOpacity: 0.7; stickerIconOpacity: 0.7;
stickerIconSel: 2px; stickerIconSel: 2px;
stickerIconSelColor: #58b2ed; stickerIconSelColor: emojiIconFgActive;
stickerIconMove: 400; stickerIconMove: 400;
stickerPreviewDuration: 150; stickerPreviewDuration: 150;
stickerPreviewBg: #FFFFFFB0; stickerPreviewBg: #FFFFFFB0;

View file

@ -146,7 +146,7 @@ void EmojiButton::paintEvent(QPaintEvent *e) {
p.setPen(pen); p.setPen(pen);
p.setBrush(Qt::NoBrush); p.setBrush(Qt::NoBrush);
p.setRenderHint(QPainter::HighQualityAntialiasing); PainterHighQualityEnabler hq(p);
QRect inner(QPoint((width() - st::historyEmojiCircle.width()) / 2, st::historyEmojiCircleTop), st::historyEmojiCircle); QRect inner(QPoint((width() - st::historyEmojiCircle.width()) / 2, st::historyEmojiCircleTop), st::historyEmojiCircle);
if (loading > 0) { if (loading > 0) {
int32 full = FullArcLength; int32 full = FullArcLength;
@ -155,7 +155,6 @@ void EmojiButton::paintEvent(QPaintEvent *e) {
} else { } else {
p.drawEllipse(inner); p.drawEllipse(inner);
} }
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
} }
void EmojiButton::setLoading(bool loading) { void EmojiButton::setLoading(bool loading) {

View file

@ -52,10 +52,13 @@ void NewAvatarButton::paintEvent(QPaintEvent *e) {
p.drawPixmap(0, 0, _image); p.drawPixmap(0, 0, _image);
return; return;
} }
p.setRenderHint(QPainter::HighQualityAntialiasing);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush((_state & StateOver) ? st::defaultActiveButton.textBgOver : st::defaultActiveButton.textBg); p.setBrush((_state & StateOver) ? st::defaultActiveButton.textBgOver : st::defaultActiveButton.textBg);
p.drawEllipse(rect()); {
PainterHighQualityEnabler hq(p);
p.drawEllipse(rect());
}
paintRipple(p, 0, 0, getms()); paintRipple(p, 0, 0, getms());

View file

@ -23,8 +23,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
namespace Ui { namespace Ui {
void CrossAnimation::paint(QPainter &p, const style::CrossAnimation &st, const style::color &color, int x, int y, int outerWidth, float64 shown) { void CrossAnimation::paint(Painter &p, const style::CrossAnimation &st, const style::color &color, int x, int y, int outerWidth, float64 shown) {
p.setRenderHint(QPainter::HighQualityAntialiasing); PainterHighQualityEnabler hq(p);
auto deleteScale = shown + st.minScale * (1. - shown); auto deleteScale = shown + st.minScale * (1. - shown);
auto deleteSkip = deleteScale * st.skip + (1. - deleteScale) * (st.size / 2); auto deleteSkip = deleteScale * st.skip + (1. - deleteScale) * (st.size / 2);
@ -67,8 +67,6 @@ void CrossAnimation::paint(QPainter &p, const style::CrossAnimation &st, const s
path.lineTo(pathDelete[i]); path.lineTo(pathDelete[i]);
} }
p.fillPath(path, color); p.fillPath(path, color);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
} }
} // namespace Ui } // namespace Ui

View file

@ -26,7 +26,7 @@ namespace Ui {
class CrossAnimation { class CrossAnimation {
public: public:
static void paint(QPainter &p, const style::CrossAnimation &st, const style::color &color, int x, int y, int outerWidth, float64 shown); static void paint(Painter &p, const style::CrossAnimation &st, const style::color &color, int x, int y, int outerWidth, float64 shown);
}; };

View file

@ -86,9 +86,10 @@ void RadialAnimation::draw(Painter &p, const QRect &inner, int32 thickness, cons
if (from < 0) from += FullArcLength; if (from < 0) from += FullArcLength;
} }
p.setRenderHint(QPainter::HighQualityAntialiasing); {
p.drawArc(inner, from, len); PainterHighQualityEnabler hq(p);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.drawArc(inner, from, len);
}
p.setPen(was); p.setPen(was);
p.setOpacity(o); p.setOpacity(o);

View file

@ -82,13 +82,11 @@ void RectShadow::paint(Painter &p, const QRect &box, int shifty, Sides sides) {
if (right && bottom) p.drawPixmap(box.left() + box.width() - minus, box.top() + box.height() - minus + shifty, _corners, _pixsize, _pixsize, _pixsize, _pixsize); if (right && bottom) p.drawPixmap(box.left() + box.width() - minus, box.top() + box.height() - minus + shifty, _corners, _pixsize, _pixsize, _pixsize, _pixsize);
if (left && bottom) p.drawPixmap(box.left() - _size + minus, box.top() + box.height() - minus + shifty, _corners, 0, _pixsize, _pixsize, _pixsize); if (left && bottom) p.drawPixmap(box.left() - _size + minus, box.top() + box.height() - minus + shifty, _corners, 0, _pixsize, _pixsize, _pixsize);
bool wasSmooth = p.renderHints().testFlag(QPainter::SmoothPixmapTransform); PainterHighQualityEnabler hq(p);
if (wasSmooth) p.setRenderHint(QPainter::SmoothPixmapTransform, false);
if (left) p.drawPixmap(box.left() - countsize + shifty, box.top() + (top ? (minus + shifty) : 0), countsize - shifty, box.height() - (bottom ? (minus - shifty) : 0) - (top ? (minus + shifty) : 0), _left, 0, 0, count - rshifty, 1); if (left) p.drawPixmap(box.left() - countsize + shifty, box.top() + (top ? (minus + shifty) : 0), countsize - shifty, box.height() - (bottom ? (minus - shifty) : 0) - (top ? (minus + shifty) : 0), _left, 0, 0, count - rshifty, 1);
if (top) p.drawPixmap(box.left() + (left ? minus : 0), box.top() - countsize + 2 * shifty, box.width() - (right ? minus : 0) - (left ? minus : 0), countsize - 2 * shifty, _top, 0, 0, 1, count - 2 * rshifty); if (top) p.drawPixmap(box.left() + (left ? minus : 0), box.top() - countsize + 2 * shifty, box.width() - (right ? minus : 0) - (left ? minus : 0), countsize - 2 * shifty, _top, 0, 0, 1, count - 2 * rshifty);
if (right) p.drawPixmap(box.left() + box.width(), box.top() + (top ? (minus + shifty) : 0), countsize - shifty, box.height() - (bottom ? (minus - shifty) : 0) - (top ? (minus + shifty) : 0), _right, rshifty, 0, count - rshifty, 1); if (right) p.drawPixmap(box.left() + box.width(), box.top() + (top ? (minus + shifty) : 0), countsize - shifty, box.height() - (bottom ? (minus - shifty) : 0) - (top ? (minus + shifty) : 0), _right, rshifty, 0, count - rshifty, 1);
if (bottom) p.drawPixmap(box.left() + (left ? minus : 0), box.top() + box.height(), box.width() - (right ? minus : 0) - (left ? minus : 0), countsize, _bottom, 0, 0, 1, count); if (bottom) p.drawPixmap(box.left() + (left ? minus : 0), box.top() + box.height(), box.width() - (right ? minus : 0) - (left ? minus : 0), countsize, _bottom, 0, 0, 1, count);
if (wasSmooth) p.setRenderHint(QPainter::SmoothPixmapTransform);
} }
style::margins RectShadow::getDimensions(int32 shifty) const { style::margins RectShadow::getDimensions(int32 shifty) const {

View file

@ -97,15 +97,16 @@ void RippleAnimation::Ripple::paint(QPainter &p, const QPixmap &mask, TimeMs ms,
_frame.fill(Qt::transparent); _frame.fill(Qt::transparent);
{ {
Painter p(&_frame); Painter p(&_frame);
p.setRenderHint(QPainter::HighQualityAntialiasing);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
if (colorOverride) { if (colorOverride) {
p.setBrush(*colorOverride); p.setBrush(*colorOverride);
} else { } else {
p.setBrush(_st.color); p.setBrush(_st.color);
} }
p.drawEllipse(_origin, radius, radius); {
PainterHighQualityEnabler hq(p);
p.drawEllipse(_origin, radius, radius);
}
p.setCompositionMode(QPainter::CompositionMode_DestinationIn); p.setCompositionMode(QPainter::CompositionMode_DestinationIn);
p.drawPixmap(0, 0, mask); p.drawPixmap(0, 0, mask);
} }
@ -199,7 +200,8 @@ QImage RippleAnimation::maskByDrawer(QSize size, bool filled, base::lambda<void(
result.fill(filled ? QColor(255, 255, 255) : Qt::transparent); result.fill(filled ? QColor(255, 255, 255) : Qt::transparent);
if (drawer) { if (drawer) {
Painter p(&result); Painter p(&result);
p.setRenderHint(QPainter::HighQualityAntialiasing); PainterHighQualityEnabler hq(p);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(QColor(255, 255, 255)); p.setBrush(QColor(255, 255, 255));
drawer(p); drawer(p);

View file

@ -34,7 +34,8 @@ void prepareCheckCaches(const style::RoundCheckbox *st, bool displayInactive, QP
cache.fill(Qt::transparent); cache.fill(Qt::transparent);
{ {
Painter p(&cache); Painter p(&cache);
p.setRenderHint(QPainter::HighQualityAntialiasing, true); PainterHighQualityEnabler hq(p);
if (displayInactive) { if (displayInactive) {
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
} else { } else {
@ -86,7 +87,8 @@ void RoundCheckbox::paint(Painter &p, TimeMs ms, int x, int y, int outerWidth, f
auto cacheFrom = QRect(0, 0, cacheSize, cacheSize); auto cacheFrom = QRect(0, 0, cacheSize, cacheSize);
auto displayInactive = !_inactiveCacheBg.isNull(); auto displayInactive = !_inactiveCacheBg.isNull();
auto inactiveTo = cacheDestRect(x, y, masterScale); auto inactiveTo = cacheDestRect(x, y, masterScale);
p.setRenderHint(QPainter::SmoothPixmapTransform, true);
PainterHighQualityEnabler hq(p);
if (!_inactiveCacheBg.isNull()) { if (!_inactiveCacheBg.isNull()) {
p.drawPixmap(inactiveTo, _inactiveCacheBg, cacheFrom); p.drawPixmap(inactiveTo, _inactiveCacheBg, cacheFrom);
} }
@ -111,7 +113,6 @@ void RoundCheckbox::paint(Painter &p, TimeMs ms, int x, int y, int outerWidth, f
if (!_inactiveCacheFg.isNull()) { if (!_inactiveCacheFg.isNull()) {
p.drawPixmap(inactiveTo, _inactiveCacheFg, cacheFrom); p.drawPixmap(inactiveTo, _inactiveCacheFg, cacheFrom);
} }
p.setRenderHint(QPainter::SmoothPixmapTransform, false);
} }
void RoundCheckbox::setChecked(bool newChecked, SetStyle speed) { void RoundCheckbox::setChecked(bool newChecked, SetStyle speed) {
@ -201,7 +202,8 @@ void RoundCheckbox::prepareInactiveCache() {
auto cacheFg = cacheBg; auto cacheFg = cacheBg;
if (_st.bgInactive) { if (_st.bgInactive) {
Painter p(&cacheBg); Painter p(&cacheBg);
p.setRenderHint(QPainter::HighQualityAntialiasing, true); PainterHighQualityEnabler hq(p);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(_st.bgInactive); p.setBrush(_st.bgInactive);
p.drawEllipse(ellipse); p.drawEllipse(ellipse);
@ -210,7 +212,8 @@ void RoundCheckbox::prepareInactiveCache() {
{ {
Painter p(&cacheFg); Painter p(&cacheFg);
p.setRenderHint(QPainter::HighQualityAntialiasing, true); PainterHighQualityEnabler hq(p);
auto pen = _st.border->p; auto pen = _st.border->p;
pen.setWidth(_st.width); pen.setWidth(_st.width);
p.setPen(pen); p.setPen(pen);
@ -239,9 +242,8 @@ void RoundImageCheckbox::paint(Painter &p, TimeMs ms, int x, int y, int outerWid
auto to = QRect(userpicLeft, userpicTop, userpicRadius * 2, userpicRadius * 2); auto to = QRect(userpicLeft, userpicTop, userpicRadius * 2, userpicRadius * 2);
auto from = QRect(QPoint(0, 0), _wideCache.size()); auto from = QRect(QPoint(0, 0), _wideCache.size());
p.setRenderHint(QPainter::SmoothPixmapTransform, true); PainterHighQualityEnabler hq(p);
p.drawPixmapLeft(to, outerWidth, _wideCache, from); p.drawPixmapLeft(to, outerWidth, _wideCache, from);
p.setRenderHint(QPainter::SmoothPixmapTransform, false);
} else { } else {
if (!_wideCache.isNull()) { if (!_wideCache.isNull()) {
_wideCache = QPixmap(); _wideCache = QPixmap();
@ -254,7 +256,7 @@ void RoundImageCheckbox::paint(Painter &p, TimeMs ms, int x, int y, int outerWid
} }
if (selectionLevel > 0) { if (selectionLevel > 0) {
p.setRenderHint(QPainter::HighQualityAntialiasing, true); PainterHighQualityEnabler hq(p);
p.setOpacity(snap(selectionLevel, 0., 1.)); p.setOpacity(snap(selectionLevel, 0., 1.));
p.setBrush(Qt::NoBrush); p.setBrush(Qt::NoBrush);
auto pen = _st.selectFg->p; auto pen = _st.selectFg->p;
@ -262,7 +264,6 @@ void RoundImageCheckbox::paint(Painter &p, TimeMs ms, int x, int y, int outerWid
p.setPen(pen); p.setPen(pen);
p.drawEllipse(rtlrect(x, y, _st.imageRadius * 2, _st.imageRadius * 2, outerWidth)); p.drawEllipse(rtlrect(x, y, _st.imageRadius * 2, _st.imageRadius * 2, outerWidth));
p.setOpacity(1.); p.setOpacity(1.);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
} }
auto iconLeft = x + 2 * _st.imageRadius + _st.selectWidth - _st.check.size; auto iconLeft = x + 2 * _st.imageRadius + _st.selectWidth - _st.check.size;

View file

@ -58,7 +58,7 @@ private:
const TypingAnimation::MetaData TypingAnimation::kMeta = { 0, &TypingAnimation::create }; const TypingAnimation::MetaData TypingAnimation::kMeta = { 0, &TypingAnimation::create };
void TypingAnimation::paintFrame(Painter &p, const style::color &color, int x, int y, int outerWidth, int frameMs) { void TypingAnimation::paintFrame(Painter &p, const style::color &color, int x, int y, int outerWidth, int frameMs) {
p.setRenderHint(QPainter::HighQualityAntialiasing); PainterHighQualityEnabler hq(p);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(color); p.setBrush(color);
auto position = QPointF(x + 0.5, y - 0.5) + st::historySendActionTypingPosition; auto position = QPointF(x + 0.5, y - 0.5) + st::historySendActionTypingPosition;
@ -76,7 +76,6 @@ void TypingAnimation::paintFrame(Painter &p, const style::color &color, int x, i
position.setX(position.x() + st::historySendActionTypingDelta); position.setX(position.x() + st::historySendActionTypingDelta);
frameMs = (frameMs + st::historySendActionTypingDuration - st::historySendActionTypingDeltaTime) % st::historySendActionTypingDuration; frameMs = (frameMs + st::historySendActionTypingDuration - st::historySendActionTypingDeltaTime) % st::historySendActionTypingDuration;
} }
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
} }
class RecordAnimation : public SendActionAnimation::Impl { class RecordAnimation : public SendActionAnimation::Impl {
@ -104,7 +103,7 @@ private:
const RecordAnimation::MetaData RecordAnimation::kMeta = { 0, &RecordAnimation::create }; const RecordAnimation::MetaData RecordAnimation::kMeta = { 0, &RecordAnimation::create };
void RecordAnimation::paintFrame(Painter &p, const style::color &color, int x, int y, int outerWidth, int frameMs) { void RecordAnimation::paintFrame(Painter &p, const style::color &color, int x, int y, int outerWidth, int frameMs) {
p.setRenderHint(QPainter::HighQualityAntialiasing); PainterHighQualityEnabler hq(p);
auto pen = color->p; auto pen = color->p;
pen.setWidth(st::historySendActionRecordStrokeNumerator / st::historySendActionRecordDenominator); pen.setWidth(st::historySendActionRecordStrokeNumerator / st::historySendActionRecordDenominator);
pen.setJoinStyle(Qt::RoundJoin); pen.setJoinStyle(Qt::RoundJoin);
@ -121,7 +120,6 @@ void RecordAnimation::paintFrame(Painter &p, const style::color &color, int x, i
size += st::historySendActionRecordDelta; size += st::historySendActionRecordDelta;
} }
p.setOpacity(1.); p.setOpacity(1.);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
} }
class UploadAnimation : public SendActionAnimation::Impl { class UploadAnimation : public SendActionAnimation::Impl {
@ -149,7 +147,7 @@ private:
const UploadAnimation::MetaData UploadAnimation::kMeta = { 0, &UploadAnimation::create }; const UploadAnimation::MetaData UploadAnimation::kMeta = { 0, &UploadAnimation::create };
void UploadAnimation::paintFrame(Painter &p, const style::color &color, int x, int y, int outerWidth, int frameMs) { void UploadAnimation::paintFrame(Painter &p, const style::color &color, int x, int y, int outerWidth, int frameMs) {
p.setRenderHint(QPainter::HighQualityAntialiasing); PainterHighQualityEnabler hq(p);
auto pen = color->p; auto pen = color->p;
pen.setWidth(st::historySendActionUploadStrokeNumerator / st::historySendActionUploadDenominator); pen.setWidth(st::historySendActionUploadStrokeNumerator / st::historySendActionUploadDenominator);
pen.setJoinStyle(Qt::RoundJoin); pen.setJoinStyle(Qt::RoundJoin);
@ -170,7 +168,6 @@ void UploadAnimation::paintFrame(Painter &p, const style::color &color, int x, i
p.translate(st::historySendActionUploadDelta, 0); p.translate(st::historySendActionUploadDelta, 0);
} }
p.setOpacity(1.); p.setOpacity(1.);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
p.translate(-position); p.translate(-position);
} }

View file

@ -44,7 +44,8 @@ const QPixmap &circleMask(int width, int height) {
QImage mask(width, height, QImage::Format_ARGB32_Premultiplied); QImage mask(width, height, QImage::Format_ARGB32_Premultiplied);
{ {
Painter p(&mask); Painter p(&mask);
p.setRenderHint(QPainter::HighQualityAntialiasing); PainterHighQualityEnabler hq(p);
p.setCompositionMode(QPainter::CompositionMode_Source); p.setCompositionMode(QPainter::CompositionMode_Source);
p.fillRect(0, 0, width, height, Qt::transparent); p.fillRect(0, 0, width, height, Qt::transparent);
p.setBrush(Qt::white); p.setBrush(Qt::white);
@ -78,9 +79,10 @@ QImage prepareBlur(QImage img) {
if (withalpha) { if (withalpha) {
QImage imgsmall(w, h, img.format()); QImage imgsmall(w, h, img.format());
{ {
QPainter p(&imgsmall); Painter p(&imgsmall);
PainterHighQualityEnabler hq(p);
p.setCompositionMode(QPainter::CompositionMode_Source); p.setCompositionMode(QPainter::CompositionMode_Source);
p.setRenderHint(QPainter::SmoothPixmapTransform);
p.fillRect(0, 0, w, h, Qt::transparent); p.fillRect(0, 0, w, h, Qt::transparent);
p.drawImage(QRect(radius, radius, w - 2 * radius, h - 2 * radius), img, QRect(0, 0, w, h)); p.drawImage(QRect(radius, radius, w - 2 * radius, h - 2 * radius), img, QRect(0, 0, w, h));
} }
@ -498,6 +500,29 @@ const QPixmap &Image::pixCircled(int32 w, int32 h) const {
return i.value(); return i.value();
} }
const QPixmap &Image::pixBlurredCircled(int32 w, int32 h) const {
checkload();
if (w <= 0 || !width() || !height()) {
w = width();
} else if (cRetina()) {
w *= cIntRetinaFactor();
h *= cIntRetinaFactor();
}
auto options = Images::Option::Smooth | Images::Option::Circled | Images::Option::Blurred;
auto k = PixKey(w, h, options);
auto i = _sizesCache.constFind(k);
if (i == _sizesCache.cend()) {
auto p = pixNoCache(w, h, options);
if (cRetina()) p.setDevicePixelRatio(cRetinaFactor());
i = _sizesCache.insert(k, p);
if (!p.isNull()) {
globalAcquiredSize += int64(p.width()) * p.height() * 4;
}
}
return i.value();
}
const QPixmap &Image::pixBlurred(int32 w, int32 h) const { const QPixmap &Image::pixBlurred(int32 w, int32 h) const {
checkload(); checkload();

View file

@ -187,12 +187,13 @@ public:
const QPixmap &pix(int32 w = 0, int32 h = 0) const; const QPixmap &pix(int32 w = 0, int32 h = 0) const;
const QPixmap &pixRounded(int32 w = 0, int32 h = 0, ImageRoundRadius radius = ImageRoundRadius::None, ImageRoundCorners corners = ImageRoundCorner::All) const; const QPixmap &pixRounded(int32 w = 0, int32 h = 0, ImageRoundRadius radius = ImageRoundRadius::None, ImageRoundCorners corners = ImageRoundCorner::All) const;
const QPixmap &pixCircled(int32 w = 0, int32 h = 0) const;
const QPixmap &pixBlurred(int32 w = 0, int32 h = 0) const; const QPixmap &pixBlurred(int32 w = 0, int32 h = 0) const;
const QPixmap &pixColored(const style::color &add, int32 w = 0, int32 h = 0) const; const QPixmap &pixColored(const style::color &add, int32 w = 0, int32 h = 0) const;
const QPixmap &pixBlurredColored(const style::color &add, int32 w = 0, int32 h = 0) const; const QPixmap &pixBlurredColored(const style::color &add, int32 w = 0, int32 h = 0) const;
const QPixmap &pixSingle(int32 w, int32 h, int32 outerw, int32 outerh, ImageRoundRadius radius, ImageRoundCorners corners = ImageRoundCorner::All) const; const QPixmap &pixSingle(int32 w, int32 h, int32 outerw, int32 outerh, ImageRoundRadius radius, ImageRoundCorners corners = ImageRoundCorner::All) const;
const QPixmap &pixBlurredSingle(int32 w, int32 h, int32 outerw, int32 outerh, ImageRoundRadius radius, ImageRoundCorners corners = ImageRoundCorner::All) const; const QPixmap &pixBlurredSingle(int32 w, int32 h, int32 outerw, int32 outerh, ImageRoundRadius radius, ImageRoundCorners corners = ImageRoundCorner::All) const;
const QPixmap &pixCircled(int32 w = 0, int32 h = 0) const;
const QPixmap &pixBlurredCircled(int32 w = 0, int32 h = 0) const;
QPixmap pixNoCache(int w = 0, int h = 0, Images::Options options = 0, int outerw = -1, int outerh = -1) const; QPixmap pixNoCache(int w = 0, int h = 0, Images::Options options = 0, int outerw = -1, int outerh = -1) const;
QPixmap pixColoredNoCache(const style::color &add, int32 w = 0, int32 h = 0, bool smooth = false) const; QPixmap pixColoredNoCache(const style::color &add, int32 w = 0, int32 h = 0, bool smooth = false) const;
QPixmap pixBlurredColoredNoCache(const style::color &add, int32 w, int32 h = 0) const; QPixmap pixBlurredColoredNoCache(const style::color &add, int32 w, int32 h = 0) const;

View file

@ -126,12 +126,13 @@ QImage createCircleMask(int size, QColor bg, QColor fg) {
auto result = QImage(realSize, realSize, QImage::Format::Format_RGB32); auto result = QImage(realSize, realSize, QImage::Format::Format_RGB32);
#endif // OS_MAC_OLD #endif // OS_MAC_OLD
{ {
QPainter pcircle(&result); Painter p(&result);
pcircle.setRenderHint(QPainter::HighQualityAntialiasing, true); PainterHighQualityEnabler hq(p);
pcircle.fillRect(0, 0, realSize, realSize, bg);
pcircle.setPen(Qt::NoPen); p.fillRect(0, 0, realSize, realSize, bg);
pcircle.setBrush(fg); p.setPen(Qt::NoPen);
pcircle.drawEllipse(0, 0, realSize, realSize); p.setBrush(fg);
p.drawEllipse(0, 0, realSize, realSize);
} }
result.setDevicePixelRatio(cRetinaFactor()); result.setDevicePixelRatio(cRetinaFactor());
return result; return result;

View file

@ -75,6 +75,40 @@ public:
void drawPixmapRight(const QPoint &p, int outerw, const QPixmap &pix) { void drawPixmapRight(const QPoint &p, int outerw, const QPixmap &pix) {
return drawPixmapRight(p.x(), p.y(), outerw, pix); return drawPixmapRight(p.x(), p.y(), outerw, pix);
} }
};
class PainterHighQualityEnabler {
public:
PainterHighQualityEnabler(Painter &p) : _painter(p) {
auto hints = _painter.renderHints();
for_const (auto hint, Hints) {
if (!(hints & hint)) {
_hints |= hint;
}
}
if (_hints) {
_painter.setRenderHints(_hints);
}
}
PainterHighQualityEnabler(const PainterHighQualityEnabler &other) = delete;
PainterHighQualityEnabler &operator=(const PainterHighQualityEnabler &other) = delete;
~PainterHighQualityEnabler() {
if (_hints) {
_painter.setRenderHints(_hints, false);
}
}
private:
Painter &_painter;
QPainter::RenderHints _hints = 0;
static constexpr QPainter::RenderHint Hints[] = {
QPainter::Antialiasing,
QPainter::SmoothPixmapTransform,
QPainter::TextAntialiasing,
QPainter::HighQualityAntialiasing
};
}; };
#define T_WIDGET \ #define T_WIDGET \

View file

@ -141,15 +141,15 @@ void Checkbox::paintEvent(QPaintEvent *e) {
paintRipple(p, _st.rippleAreaPosition.x(), _st.rippleAreaPosition.y(), ms, &color); paintRipple(p, _st.rippleAreaPosition.x(), _st.rippleAreaPosition.y(), ms, &color);
if (_checkRect.intersects(e->rect())) { if (_checkRect.intersects(e->rect())) {
p.setRenderHint(QPainter::HighQualityAntialiasing);
auto pen = anim::pen(_st.checkFg, _st.checkFgActive, active); auto pen = anim::pen(_st.checkFg, _st.checkFgActive, active);
pen.setWidth(_st.thickness); pen.setWidth(_st.thickness);
p.setPen(pen); p.setPen(pen);
p.setBrush(anim::brush(_st.checkBg, anim::color(_st.checkFg, _st.checkFgActive, active), active)); p.setBrush(anim::brush(_st.checkBg, anim::color(_st.checkFg, _st.checkFgActive, active), active));
p.drawRoundedRect(QRectF(_checkRect).marginsRemoved(QMarginsF(_st.thickness / 2., _st.thickness / 2., _st.thickness / 2., _st.thickness / 2.)), st::buttonRadius - (_st.thickness / 2.), st::buttonRadius - (_st.thickness / 2.)); {
p.setRenderHint(QPainter::HighQualityAntialiasing, false); PainterHighQualityEnabler hq(p);
p.drawRoundedRect(QRectF(_checkRect).marginsRemoved(QMarginsF(_st.thickness / 2., _st.thickness / 2., _st.thickness / 2., _st.thickness / 2.)), st::buttonRadius - (_st.thickness / 2.), st::buttonRadius - (_st.thickness / 2.));
}
if (active > 0) { if (active > 0) {
_st.checkIcon.paint(p, QPoint(_st.margin.left(), _st.margin.top()), width()); _st.checkIcon.paint(p, QPoint(_st.margin.left(), _st.margin.top()), width());
@ -247,7 +247,7 @@ void Radiobutton::paintEvent(QPaintEvent *e) {
paintRipple(p, _st.rippleAreaPosition.x(), _st.rippleAreaPosition.y(), ms, &color); paintRipple(p, _st.rippleAreaPosition.x(), _st.rippleAreaPosition.y(), ms, &color);
if (_checkRect.intersects(e->rect())) { if (_checkRect.intersects(e->rect())) {
p.setRenderHint(QPainter::HighQualityAntialiasing); PainterHighQualityEnabler hq(p);
auto pen = anim::pen(_st.checkFg, _st.checkFgActive, active); auto pen = anim::pen(_st.checkFg, _st.checkFgActive, active);
pen.setWidth(_st.thickness); pen.setWidth(_st.thickness);
@ -275,8 +275,6 @@ void Radiobutton::paintEvent(QPaintEvent *e) {
// } // }
//} //}
} }
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
} }
if (_checkRect.contains(e->rect())) return; if (_checkRect.contains(e->rect())) return;

View file

@ -186,8 +186,9 @@ float64 FilledSlider::getOverDuration() const {
void FilledSlider::paintEvent(QPaintEvent *e) { void FilledSlider::paintEvent(QPaintEvent *e) {
Painter p(this); Painter p(this);
PainterHighQualityEnabler hq(p);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setRenderHint(QPainter::HighQualityAntialiasing);
auto masterOpacity = fadeOpacity(); auto masterOpacity = fadeOpacity();
auto ms = getms(); auto ms = getms();
@ -233,8 +234,9 @@ float64 MediaSlider::getOverDuration() const {
void MediaSlider::paintEvent(QPaintEvent *e) { void MediaSlider::paintEvent(QPaintEvent *e) {
Painter p(this); Painter p(this);
PainterHighQualityEnabler hq(p);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setRenderHint(QPainter::HighQualityAntialiasing);
p.setOpacity(fadeOpacity()); p.setOpacity(fadeOpacity());
auto horizontal = isHorizontal(); auto horizontal = isHorizontal();

View file

@ -1542,13 +1542,14 @@ void FlatInput::paintEvent(QPaintEvent *e) {
auto ms = getms(); auto ms = getms();
auto placeholderFocused = _a_placeholderFocused.current(ms, hasFocus() ? 1. : 0.); auto placeholderFocused = _a_placeholderFocused.current(ms, hasFocus() ? 1. : 0.);
p.setRenderHint(QPainter::HighQualityAntialiasing);
auto pen = anim::pen(_st.borderColor, _st.borderActive, placeholderFocused); auto pen = anim::pen(_st.borderColor, _st.borderActive, placeholderFocused);
pen.setWidth(_st.borderWidth); pen.setWidth(_st.borderWidth);
p.setPen(pen); p.setPen(pen);
p.setBrush(anim::brush(_st.bgColor, _st.bgActive, placeholderFocused)); p.setBrush(anim::brush(_st.bgColor, _st.bgActive, placeholderFocused));
p.drawRoundedRect(QRectF(0, 0, width(), height()).marginsRemoved(QMarginsF(_st.borderWidth / 2., _st.borderWidth / 2., _st.borderWidth / 2., _st.borderWidth / 2.)), st::buttonRadius - (_st.borderWidth / 2.), st::buttonRadius - (_st.borderWidth / 2.)); {
p.setRenderHint(QPainter::HighQualityAntialiasing, false); PainterHighQualityEnabler hq(p);
p.drawRoundedRect(QRectF(0, 0, width(), height()).marginsRemoved(QMarginsF(_st.borderWidth / 2., _st.borderWidth / 2., _st.borderWidth / 2., _st.borderWidth / 2.)), st::buttonRadius - (_st.borderWidth / 2.), st::buttonRadius - (_st.borderWidth / 2.));
}
if (!_st.icon.empty()) { if (!_st.icon.empty()) {
_st.icon.paint(p, 0, 0, width()); _st.icon.paint(p, 0, 0, width());

View file

@ -170,19 +170,20 @@ void MultiSelect::Inner::Item::paintOnce(Painter &p, int x, int y, int outerWidt
auto clipEnabled = p.hasClipping(); auto clipEnabled = p.hasClipping();
auto clip = clipEnabled ? p.clipRegion() : QRegion(); auto clip = clipEnabled ? p.clipRegion() : QRegion();
p.setRenderHint(QPainter::HighQualityAntialiasing);
p.setClipRect(inner); p.setClipRect(inner);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(_active ? _st.textActiveBg : _st.textBg); p.setBrush(_active ? _st.textActiveBg : _st.textBg);
p.drawRoundedRect(rtlrect(x, y, _width, _st.height, outerWidth), radius, radius); {
PainterHighQualityEnabler hq(p);
p.drawRoundedRect(rtlrect(x, y, _width, _st.height, outerWidth), radius, radius);
}
if (clipEnabled) { if (clipEnabled) {
p.setClipRegion(clip); p.setClipRegion(clip);
} else { } else {
p.setClipping(false); p.setClipping(false);
} }
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
auto overOpacity = _overOpacity.current(ms, _over ? 1. : 0.); auto overOpacity = _overOpacity.current(ms, _over ? 1. : 0.);
if (overOpacity < 1.) { if (overOpacity < 1.) {
@ -203,9 +204,10 @@ void MultiSelect::Inner::Item::paintDeleteButton(Painter &p, int x, int y, int o
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
p.setBrush(_color); p.setBrush(_color);
p.setRenderHint(QPainter::HighQualityAntialiasing); {
p.drawEllipse(rtlrect(x, y, _st.height, _st.height, outerWidth)); PainterHighQualityEnabler hq(p);
p.setRenderHint(QPainter::HighQualityAntialiasing, false); p.drawEllipse(rtlrect(x, y, _st.height, _st.height, outerWidth));
}
CrossAnimation::paint(p, _st.deleteCross, _st.deleteFg, x, y, outerWidth, overOpacity); CrossAnimation::paint(p, _st.deleteCross, _st.deleteFg, x, y, outerWidth, overOpacity);
@ -213,15 +215,15 @@ void MultiSelect::Inner::Item::paintDeleteButton(Painter &p, int x, int y, int o
} }
bool MultiSelect::Inner::Item::paintCached(Painter &p, int x, int y, int outerWidth) { bool MultiSelect::Inner::Item::paintCached(Painter &p, int x, int y, int outerWidth) {
PainterHighQualityEnabler hq(p);
auto opacity = _visibility.current(_hiding ? 0. : 1.); auto opacity = _visibility.current(_hiding ? 0. : 1.);
auto scale = opacity + _st.minScale * (1. - opacity); auto scale = opacity + _st.minScale * (1. - opacity);
auto height = opacity * _cache.height() / _cache.devicePixelRatio(); auto height = opacity * _cache.height() / _cache.devicePixelRatio();
auto width = opacity * _cache.width() / _cache.devicePixelRatio(); auto width = opacity * _cache.width() / _cache.devicePixelRatio();
p.setOpacity(opacity); p.setOpacity(opacity);
p.setRenderHint(QPainter::SmoothPixmapTransform, true);
p.drawPixmap(rtlrect(x + (_width - width) / 2., y + (_st.height - height) / 2., width, height, outerWidth), _cache); p.drawPixmap(rtlrect(x + (_width - width) / 2., y + (_st.height - height) / 2., width, height, outerWidth), _cache);
p.setRenderHint(QPainter::SmoothPixmapTransform, false);
p.setOpacity(1.); p.setOpacity(1.);
return true; return true;
} }

View file

@ -139,7 +139,7 @@ void ScrollBar::paintEvent(QPaintEvent *e) {
} }
if (a_fullOpacity.current() == 0.) return; if (a_fullOpacity.current() == 0.) return;
QPainter p(this); Painter p(this);
auto deltal = _vertical ? _st->deltax : 0, deltar = _vertical ? _st->deltax : 0; auto deltal = _vertical ? _st->deltax : 0, deltar = _vertical ? _st->deltax : 0;
auto deltat = _vertical ? 0 : _st->deltax, deltab = _vertical ? 0 : _st->deltax; auto deltat = _vertical ? 0 : _st->deltax, deltab = _vertical ? 0 : _st->deltax;
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
@ -148,12 +148,11 @@ void ScrollBar::paintEvent(QPaintEvent *e) {
auto bar = anim::color(_st->barColor, _st->barOverColor, a_barOver.current()); auto bar = anim::color(_st->barColor, _st->barOverColor, a_barOver.current());
bar.setAlpha(anim::interpolate(0, bar.alpha(), a_fullOpacity.current())); bar.setAlpha(anim::interpolate(0, bar.alpha(), a_fullOpacity.current()));
if (_st->round) { if (_st->round) {
p.setRenderHint(QPainter::HighQualityAntialiasing, true); PainterHighQualityEnabler hq(p);
p.setBrush(bg); p.setBrush(bg);
p.drawRoundedRect(QRect(deltal, deltat, width() - deltal - deltar, height() - deltat - deltab), _st->round, _st->round); p.drawRoundedRect(QRect(deltal, deltat, width() - deltal - deltar, height() - deltat - deltab), _st->round, _st->round);
p.setBrush(bar); p.setBrush(bar);
p.drawRoundedRect(_bar, _st->round, _st->round); p.drawRoundedRect(_bar, _st->round, _st->round);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
} else { } else {
p.fillRect(QRect(deltal, deltat, width() - deltal - deltar, height() - deltat - deltab), bg); p.fillRect(QRect(deltal, deltat, width() - deltal - deltar, height() - deltat - deltab), bg);
p.fillRect(_bar, bar); p.fillRect(_bar, bar);

View file

@ -464,9 +464,9 @@ defaultFlatLabel: FlatLabel {
} }
defaultLinkButton: LinkButton { defaultLinkButton: LinkButton {
color: btnYesColor; color: windowActiveTextFg;
overColor: btnYesColor; overColor: windowActiveTextFg;
downColor: btnYesHover; downColor: windowActiveTextFg;
font: linkFont; font: linkFont;
overFont: linkOverFont; overFont: linkOverFont;
} }
@ -616,7 +616,7 @@ defaultInputArea: InputArea {
duration: 120; duration: 120;
borderFg: #e0e0e0; borderFg: #e0e0e0;
borderFgActive: #62c0f7; borderFgActive: activeLineFg;
borderFgError: #e48383; borderFgError: #e48383;
border: 1px; border: 1px;
@ -643,7 +643,7 @@ defaultInputField: InputField {
duration: 120; duration: 120;
borderFg: #e0e0e0; borderFg: #e0e0e0;
borderFgActive: #62c0f7; borderFgActive: activeLineFg;
borderFgError: #e48383; borderFgError: #e48383;
border: 1px; border: 1px;
@ -719,8 +719,8 @@ defaultSettingsSlider: SettingsSlider {
barFgActive: windowBgActive; barFgActive: windowBgActive;
labelTop: 17px; labelTop: 17px;
labelFont: normalFont; labelFont: normalFont;
labelFg: #1485c2; labelFg: windowActiveTextFg;
labelFgActive: #1485c2; labelFgActive: windowActiveTextFg;
duration: 150; duration: 150;
} }

View file

@ -72,6 +72,8 @@ MainMenu::MainMenu(QWidget *parent) : TWidget(parent)
_version->setLink(2, MakeShared<LambdaClickHandler>([] { Ui::showLayer(new AboutBox()); })); _version->setLink(2, MakeShared<LambdaClickHandler>([] { Ui::showLayer(new AboutBox()); }));
subscribe(FileDownload::ImageLoaded(), [this] { update(); }); subscribe(FileDownload::ImageLoaded(), [this] { update(); });
subscribe(Global::RefConnectionTypeChanged(), [this] { updateConnectionState(); });
updateConnectionState();
} }
void MainMenu::checkSelf() { void MainMenu::checkSelf() {
@ -110,6 +112,16 @@ void MainMenu::updateControlsGeometry() {
_version->moveToLeft(st::mainMenuFooterLeft, height() - st::mainMenuVersionBottom - _version->height()); _version->moveToLeft(st::mainMenuFooterLeft, height() - st::mainMenuVersionBottom - _version->height());
} }
void MainMenu::updateConnectionState() {
auto state = MTP::dcstate();
if (state == MTP::ConnectingState || state == MTP::DisconnectedState || state < 0) {
_connectionText = lang(lng_status_connecting);
} else {
_connectionText = lang(lng_status_online);
}
update();
}
void MainMenu::paintEvent(QPaintEvent *e) { void MainMenu::paintEvent(QPaintEvent *e) {
Painter p(this); Painter p(this);
auto clip = e->rect(); auto clip = e->rect();
@ -121,7 +133,7 @@ void MainMenu::paintEvent(QPaintEvent *e) {
if (auto self = App::self()) { if (auto self = App::self()) {
self->nameText.drawLeftElided(p, st::mainMenuCoverTextLeft, st::mainMenuCoverNameTop, width() - 2 * st::mainMenuCoverTextLeft, width()); self->nameText.drawLeftElided(p, st::mainMenuCoverTextLeft, st::mainMenuCoverNameTop, width() - 2 * st::mainMenuCoverTextLeft, width());
p.setFont(st::normalFont); p.setFont(st::normalFont);
p.drawTextLeft(st::mainMenuCoverTextLeft, st::mainMenuCoverStatusTop, width(), qsl("online")); p.drawTextLeft(st::mainMenuCoverTextLeft, st::mainMenuCoverStatusTop, width(), _connectionText);
} }
} }
auto other = QRect(0, st::mainMenuCoverHeight, width(), height() - st::mainMenuCoverHeight).intersected(clip); auto other = QRect(0, st::mainMenuCoverHeight, width(), height() - st::mainMenuCoverHeight).intersected(clip);

View file

@ -49,6 +49,7 @@ protected:
private: private:
void checkSelf(); void checkSelf();
void updateControlsGeometry(); void updateControlsGeometry();
void updateConnectionState();
ChildWidget<Profile::UserpicButton> _userpicButton = { nullptr }; ChildWidget<Profile::UserpicButton> _userpicButton = { nullptr };
ChildWidget<Ui::Menu> _menu; ChildWidget<Ui::Menu> _menu;
@ -56,6 +57,7 @@ private:
ChildWidget<Ui::FlatLabel> _version; ChildWidget<Ui::FlatLabel> _version;
bool _showFinished = false; bool _showFinished = false;
QString _connectionText;
}; };

View file

@ -3,4 +3,4 @@ AppVersionStrMajor 0.10
AppVersionStrSmall 0.10.20 AppVersionStrSmall 0.10.20
AppVersionStr 0.10.20 AppVersionStr 0.10.20
AlphaChannel 0 AlphaChannel 0
BetaVersion 10019010 BetaVersion 10019011