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;
slideShadow: icon {{ "slide_shadow", windowShadowFg }};
btnYesColor: #0080c0;
btnYesHover: #0073ad;
btnNoColor: #8b8b8b;
btnNoHover: #777777;
linkCropLimit: 360px;
linkFont: normalFont;
linkOverFont: font(fsize underline);
@ -82,8 +77,6 @@ linkOverFont: font(fsize underline);
dateRadius: 6px;
buttonRadius: 3px;
lnkText: #0f7dc7;
setLittleSkip: 9px;
noContactsHeight: 100px;
@ -114,8 +107,8 @@ msgOutBg: #effdde;
msgOutBgSelected: #b7dbdb;
msgSelectOverlay: #358cd44c;
msgStickerOverlay: #358cd47f;
msgInServiceFg: #0e7acd;
msgInServiceFgSelected: #0e7acd;
msgInServiceFg: windowActiveTextFg;
msgInServiceFgSelected: windowActiveTextFg;
msgOutServiceFg: #3a8e26;
msgOutServiceFgSelected: #367570;
msgShadow: 2px;
@ -132,8 +125,8 @@ msgReplyPadding: margins(6px, 6px, 11px, 6px);
msgReplyBarPos: point(1px, 0px);
msgReplyBarSize: size(2px, 36px);
msgReplyBarSkip: 10px;
msgInReplyBarColor: #2fa9e2;
msgInReplyBarSelColor: #2fa9e2;
msgInReplyBarColor: activeLineFg;
msgInReplyBarSelColor: activeLineFg;
msgOutReplyBarColor: historyOutIconFg;
msgOutReplyBarSelColor: historyOutIconFgSelected;
msgImgReplyBarColor: #ffffff;
@ -146,10 +139,6 @@ msgServiceMargin: margins(10px, 10px, 80px, 2px);
msgColor: #000000;
msgDateColor: #000000;
msgLinkColor: #2a6dc2;
msgPressedLinkColor: #004bad;
msgSkip: 40px;
msgPtr: 8px;
msgDateSpace: 12px;
msgDateDelta: point(2px, 5px);
@ -165,8 +154,8 @@ msgDateImgCheckSpace: 4px;
defaultTextStyle: TextStyle {
linkFlags: font(fsize);
linkFlagsOver: font(fsize underline);
linkFg: btnYesColor;
linkFgDown: btnYesHover;
linkFg: windowActiveTextFg;
linkFgDown: windowActiveTextFg;
monoFg: #777777;
selectBg: msgInBgSelected;
selectOverlay: msgSelectOverlay;
@ -214,7 +203,7 @@ medviewSaveAsTextStyle: TextStyle(defaultTextStyle) {
linkFgDown: #91d9ff;
}
mediaPadding: margins(0px, 0px, 0px, 0px);//1px, 1px, 1px, 1px);//2px, 2px, 2px, 2px);
mediaPadding: margins(0px, 0px, 0px, 0px);
mediaCaptionSkip: 5px;
mediaInBubbleSkip: 5px;
mediaThumbSize: 48px;
@ -310,10 +299,11 @@ unreadBarBorder: shadowColor;
unreadBarColor: #538bb4;
searchedBarHeight: unreadBarHeight;
searchedBarFont: unreadBarFont;
searchedBarBG: #ebeef1;
searchedBarFont: normalFont;
searchedBarBg: windowBgOver;
searchedBarBorder: unreadBarBorder;
searchedBarColor: #a2aeb7;
searchedBarFg: windowSubTextFgOver;
searchedBarPosition: point(17px, 7px);
simpleCloseIcon: icon {{ "simple_close", #c7c7c7 }};
simpleCloseIconOver: icon {{ "simple_close", #a3a3a3 }};
@ -346,7 +336,7 @@ dragBg: #ffffff;
dragFont: font(28px semibold);
dragSubfont: font(20px semibold);
dragColor: #777777;
dragDropColor: btnYesColor;
dragDropColor: windowActiveTextFg;
dragMargin: margins(0px, 10px, 0px, 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
windowBoldFg: #222222; // dark gray: fallback for 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
windowActiveTextFg: #2687bf; // online blue: fallback for active color
windowActiveTextFg: #168acd; // online blue: fallback for active 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;
imageBgTransparent: #ffffff;
@ -46,11 +46,12 @@ activeButtonFg: windowFgActive;
activeButtonFgOver: activeButtonFg;
activeButtonSecondaryFg: #cceeff;
activeButtonSecondaryFgOver: activeButtonSecondaryFg;
activeLineFg: #37a1de;
lightButtonBg: windowBg;
lightButtonBgOver: #e3f1fa;
lightButtonBgRipple: #c9e4f6;
lightButtonFg: #2b99d5;
lightButtonFg: windowActiveTextFg;
lightButtonFgOver: lightButtonFg;
attentionButtonFg: #d14e4e;
@ -139,15 +140,15 @@ dialogsNameFg: windowBoldFg;
dialogsChatIconFg: dialogsNameFg;
dialogsDateFg: windowSubTextFg;
dialogsTextFg: windowSubTextFg;
dialogsTextFgService: #4981af;
dialogsTextFgService: windowActiveTextFg;
dialogsDraftFg: #dd4b39;
dialogsVerifiedIconBg: #4abcf1;
dialogsVerifiedIconFg: #ffffff;
dialogsVerifiedIconBg: windowBgActive;
dialogsVerifiedIconFg: windowFgActive;
dialogsSendingIconFg: #c1c1c1;
dialogsSentIconFg: #5dc452;
dialogsUnreadBg: windowBgActive;
dialogsUnreadBgMuted: #bbbbbb;
dialogsUnreadFg: #ffffff;
dialogsUnreadFg: windowFgActive;
dialogsBgOver: windowBgOver;
dialogsNameFgOver: windowBoldFgOver;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2165,11 +2165,12 @@ namespace {
int32 r = radius * cIntRetinaFactor(), s = st::msgShadow * cIntRetinaFactor();
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.fillRect(QRect(0, 0, rect.width(), rect.height()), Qt::transparent);
p.setCompositionMode(QPainter::CompositionMode_SourceOver);
p.setRenderHint(QPainter::HighQualityAntialiasing);
p.setPen(Qt::NoPen);
if (shadow) {
p.setBrush((*shadow)->b);

View File

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

View File

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

View File

@ -344,7 +344,7 @@ sharePhotoCheckbox: RoundImageCheckbox(contactsPhotoCheckbox) {
}
shareNameFont: font(11px);
shareNameFg: windowFg;
shareNameActiveFg: btnYesColor;
shareNameActiveFg: windowActiveTextFg;
shareNameTop: 6px;
shareColumnSkip: 6px;
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());
p.setRenderHint(QPainter::HighQualityAntialiasing, true);
{
PainterHighQualityEnabler hq(p);
p.setPen(userpicBorderPen);
p.setBrush(Qt::NoBrush);
p.drawEllipse(userpicEllipse);
p.setPen(userpicBorderPen);
p.setBrush(Qt::NoBrush);
p.drawEllipse(userpicEllipse);
p.setPen(iconBorderPen);
p.setBrush(st::contactsPhotoDisabledCheckFg);
p.drawEllipse(iconEllipse);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
p.setPen(iconBorderPen);
p.setBrush(st::contactsPhotoDisabledCheckFg);
p.drawEllipse(iconEllipse);
}
st::contactsPhotoCheckbox.check.check.paint(p, iconEllipse.topLeft(), outerWidth);
}
@ -1071,10 +1071,10 @@ void ContactsBox::Inner::paintEvent(QPaintEvent *e) {
yTo -= _contacts->size() * _rowHeight;
}
if (!_byUsername.isEmpty()) {
p.fillRect(0, 0, width(), st::searchedBarHeight, st::searchedBarBG->b);
p.setFont(st::searchedBarFont->f);
p.setPen(st::searchedBarColor->p);
p.drawText(QRect(0, 0, width(), st::searchedBarHeight), lang(lng_search_global_results), style::al_center);
p.fillRect(0, 0, width(), st::searchedBarHeight, st::searchedBarBg);
p.setFont(st::searchedBarFont);
p.setPen(st::searchedBarFg);
p.drawTextLeft(st::searchedBarPosition.x(), st::searchedBarPosition.y(), width(), lang(lng_search_global_results), style::al_center);
yFrom -= st::searchedBarHeight;
yTo -= st::searchedBarHeight;
@ -1135,10 +1135,10 @@ void ContactsBox::Inner::paintEvent(QPaintEvent *e) {
}
}
if (!_byUsernameFiltered.isEmpty()) {
p.fillRect(0, 0, width(), st::searchedBarHeight, st::searchedBarBG->b);
p.setFont(st::searchedBarFont->f);
p.setPen(st::searchedBarColor->p);
p.drawText(QRect(0, 0, width(), st::searchedBarHeight), lang(lng_search_global_results), style::al_center);
p.fillRect(0, 0, width(), st::searchedBarHeight, st::searchedBarBg);
p.setFont(st::searchedBarFont);
p.setPen(st::searchedBarFg);
p.drawTextLeft(st::searchedBarPosition.x(), st::searchedBarPosition.y(), width(), lang(lng_search_global_results), style::al_center);
p.translate(0, st::searchedBarHeight);
yFrom -= _filtered.size() * _rowHeight + st::searchedBarHeight;

View File

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

View File

@ -245,7 +245,8 @@ void PhotoCropBox::paintEvent(QPaintEvent *e) {
_mask.fill(Qt::white);
{
Painter p(&_mask);
p.setRenderHint(QPainter::HighQualityAntialiasing);
PainterHighQualityEnabler hq(p);
p.setPen(Qt::NoPen);
p.setBrush(Qt::black);
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)
, _files(files)
, _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)
, _cancel(this, lang(lng_cancel), st::cancelBoxButton) {
updateTitleText();
@ -245,9 +245,10 @@ void SendFilesBox::paintEvent(QPaintEvent *e) {
p.setPen(Qt::NoPen);
p.setBrush(st::msgDateImgBg);
p.setRenderHint(QPainter::HighQualityAntialiasing);
p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
{
PainterHighQualityEnabler hq(p);
p.drawEllipse(inner);
}
auto icon = &st::historyFileInPlay;
icon->paintInCenter(p, inner);
@ -279,9 +280,10 @@ void SendFilesBox::paintEvent(QPaintEvent *e) {
p.setPen(Qt::NoPen);
p.setBrush(st::msgFileOutBg);
p.setRenderHint(QPainter::HighQualityAntialiasing);
p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
{
PainterHighQualityEnabler hq(p);
p.drawEllipse(inner);
}
auto &icon = _fileIsImage ? st::historyFileOutImage : st::historyFileOutDocument;
icon.paintInCenter(p, inner);
@ -541,10 +543,11 @@ void EditCaptionBox::paintEvent(QPaintEvent *e) {
p.setPen(Qt::NoPen);
p.setBrush(st::msgDateImgBg);
p.setRenderHint(QPainter::HighQualityAntialiasing);
p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
{
PainterHighQualityEnabler hq(p);
p.drawEllipse(inner);
}
auto icon = &st::historyFileInPlay;
icon->paintInCenter(p, inner);
}
@ -580,9 +583,10 @@ void EditCaptionBox::paintEvent(QPaintEvent *e) {
p.setPen(Qt::NoPen);
p.setBrush(st::msgFileInBg);
p.setRenderHint(QPainter::HighQualityAntialiasing);
p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
{
PainterHighQualityEnabler hq(p);
p.drawEllipse(inner);
}
auto icon = &(_isImage ? st::historyFileInImage : st::historyFileInDocument);
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.setBrush(st::stickersFeaturedUnreadBg);
p.setRenderHint(QPainter::HighQualityAntialiasing, true);
p.drawEllipse(rtlrect(namex + s->titleWidth + st::stickersFeaturedUnreadSkip, namey + st::stickersFeaturedUnreadTop, st::stickersFeaturedUnreadSize, st::stickersFeaturedUnreadSize, width()));
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
{
PainterHighQualityEnabler hq(p);
p.drawEllipse(rtlrect(namex + s->titleWidth + st::stickersFeaturedUnreadSkip, namey + st::stickersFeaturedUnreadTop, st::stickersFeaturedUnreadSize, st::stickersFeaturedUnreadSize, width()));
}
}
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));
}
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

View File

@ -22,7 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "core/utils.h"
#define BETA_VERSION_MACRO (10019010ULL)
#define BETA_VERSION_MACRO (10019011ULL)
constexpr int AppVersion = 10020;
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()) {
p.fillRect(0, 0, fullWidth(), st::searchedBarHeight, st::searchedBarBG->b);
p.fillRect(0, 0, fullWidth(), st::searchedBarHeight, st::searchedBarBg);
if (!paintingOther) {
p.setFont(st::searchedBarFont->f);
p.setPen(st::searchedBarColor->p);
p.drawText(QRect(0, 0, fullWidth(), st::searchedBarHeight), lang(lng_search_global_results), style::al_center);
p.setFont(st::searchedBarFont);
p.setPen(st::searchedBarFg);
p.drawTextLeft(st::searchedBarPosition.x(), st::searchedBarPosition.y(), width(), lang(lng_search_global_results), style::al_center);
}
p.translate(0, st::searchedBarHeight);
@ -207,11 +207,11 @@ void DialogsInner::paintRegion(Painter &p, const QRegion &region, bool paintingO
searchInPeerPaint(p, fullWidth(), paintingOther);
p.translate(0, st::dialogsRowHeight);
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) {
p.setFont(st::searchedBarFont->f);
p.setPen(st::searchedBarColor->p);
p.drawText(QRect(0, 0, fullWidth(), st::searchedBarHeight), lang(lng_dlg_search_for_messages), style::al_center);
p.setFont(st::searchedBarFont);
p.setPen(st::searchedBarFg);
p.drawTextLeft(st::searchedBarPosition.x(), st::searchedBarPosition.y(), width(), lang(lng_dlg_search_for_messages), style::al_center);
}
p.translate(0, st::searchedBarHeight);
}
@ -219,11 +219,11 @@ void DialogsInner::paintRegion(Painter &p, const QRegion &region, bool paintingO
if (_state == SearchedState || !_searchResults.isEmpty()) {
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) {
p.setFont(st::searchedBarFont->f);
p.setPen(st::searchedBarColor->p);
p.drawText(QRect(0, 0, fullWidth(), st::searchedBarHeight), text, style::al_center);
p.setFont(st::searchedBarFont);
p.setPen(st::searchedBarFg);
p.drawTextLeft(st::searchedBarPosition.x(), st::searchedBarPosition.y(), width(), text, style::al_center);
}
p.translate(0, st::searchedBarHeight);

View File

@ -38,8 +38,8 @@ Q_DECLARE_METATYPE(Ui::ShowWay);
namespace App {
void LambdaDelayed(int duration, base::lambda<void()> &&lambda) {
QTimer::singleShot(duration, base::lambda_slot(App::app(), std_::move(lambda)), SLOT(action()));
void CallDelayed(int duration, base::lambda<void()> &&lambda) {
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) {

View File

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

View File

@ -393,23 +393,30 @@ void HistoryPhoto::draw(Painter &p, const QRect &r, TextSelection selection, Tim
} else {
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));
p.drawPixmap(rthumb.topLeft(), pix);
if (selected) {
App::complexOverlayRect(p, rthumb, roundRadius, roundCorners);
QPixmap pix;
if (_parent->toHistoryMessage()) {
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())) {
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);
@ -426,9 +433,10 @@ void HistoryPhoto::draw(Painter &p, const QRect &r, TextSelection selection, Tim
p.setOpacity(radialOpacity * p.opacity());
p.setRenderHint(QPainter::HighQualityAntialiasing);
p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
{
PainterHighQualityEnabler hq(p);
p.drawEllipse(inner);
}
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.setRenderHint(QPainter::HighQualityAntialiasing);
p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
{
PainterHighQualityEnabler hq(p);
p.drawEllipse(inner);
}
if (!selected && _animation) {
p.setOpacity(1);
@ -1123,9 +1132,10 @@ void HistoryDocument::draw(Painter &p, const QRect &r, TextSelection selection,
}
p.setOpacity(radialOpacity * p.opacity());
p.setRenderHint(QPainter::HighQualityAntialiasing);
p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
{
PainterHighQualityEnabler hq(p);
p.drawEllipse(inner);
}
p.setOpacity(radialOpacity);
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.setRenderHint(QPainter::HighQualityAntialiasing);
p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
{
PainterHighQualityEnabler hq(p);
p.drawEllipse(inner);
}
if (radial) {
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.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));
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
{
PainterHighQualityEnabler hq(p);
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.setRenderHint(QPainter::HighQualityAntialiasing);
p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
{
PainterHighQualityEnabler hq(p);
p.drawEllipse(inner);
}
p.setOpacity(radialOpacity);
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);
p.setPen(Qt::NoPen);
p.setBrush(st::msgServiceBg);
p.setRenderHint(QPainter::HighQualityAntialiasing);
p.drawEllipse(rtlrect(position.x(), position.y(), st::historyEmptySize, st::historyEmptySize, width));
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
{
PainterHighQualityEnabler hq(p);
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);
}

View File

@ -3102,7 +3102,7 @@ HistoryWidget::HistoryWidget(QWidget *parent) : TWidget(parent)
}
_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();
}));
});
@ -8736,11 +8736,13 @@ void HistoryWidget::drawRecordButton(Painter &p) {
void HistoryWidget::drawRecording(Painter &p) {
p.setPen(Qt::NoPen);
p.setBrush(st::historyRecordSignalColor);
p.setRenderHint(QPainter::HighQualityAntialiasing);
float64 delta = qMin(float64(a_recordingLevel.current()) / 0x4000, 1.);
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);
p.setFont(st::historyRecordFont);
@ -8834,15 +8836,12 @@ void HistoryWidget::paintEvent(QPaintEvent *e) {
}
}
} else {
bool smooth = p.renderHints().testFlag(QPainter::SmoothPixmapTransform);
p.setRenderHint(QPainter::SmoothPixmapTransform);
PainterHighQualityEnabler hq(p);
QRect to, from;
App::main()->backgroundParams(fill, to, from);
to.moveTop(to.top() + fromy);
p.drawPixmap(to, pix, from);
if (!smooth) p.setRenderHint(QPainter::SmoothPixmapTransform, false);
}
} else {
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.setRenderHint(QPainter::HighQualityAntialiasing);
p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
{
PainterHighQualityEnabler hq(p);
p.drawEllipse(inner);
}
if (radial) {
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()));
_photo->setClickedCallback([this] {
auto imgExtensions = cImgExtensions();
auto filter = qsl("Image files (*") + imgExtensions.join(qsl(" *")) + qsl(");;") + filedialogAllFilesFilter();
_readPhotoFileQueryId = FileDialog::queryReadFile(lang(lng_choose_image), filter);
App::CallDelayed(st::defaultActiveButton.ripple.hideDuration, base::lambda_guarded(this, [this] {
auto imgExtensions = cImgExtensions();
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) {
notifyFileQueryUpdated(update);

View File

@ -218,6 +218,7 @@ void MainWindow::clearWidgets() {
hideMediaview();
_mediaView->rpcClear();
}
App::clearHistories();
updateGlobalMenu();
}
@ -1492,7 +1493,7 @@ PreLaunchWindow::PreLaunchWindow(QString title) : TWidget(0) {
int paddingVertical = (_size / 2);
int paddingHorizontal = _size;
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) {
PreLaunchWindowInstance = this;
}

View File

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

View File

@ -1568,10 +1568,8 @@ void MediaView::paintEvent(QPaintEvent *e) {
p.fillRect(imgRect, _transparentBrush);
}
if (toDraw.width() != _w * cIntRetinaFactor()) {
bool was = (p.renderHints() & QPainter::SmoothPixmapTransform);
if (!was) p.setRenderHint(QPainter::SmoothPixmapTransform, true);
PainterHighQualityEnabler hq(p);
p.drawPixmap(QRect(_x, _y, _w, _h), toDraw);
if (!was) p.setRenderHint(QPainter::SmoothPixmapTransform, false);
} else {
p.drawPixmap(_x, _y, toDraw);
}
@ -1591,9 +1589,10 @@ void MediaView::paintEvent(QPaintEvent *e) {
p.setOpacity(radialOpacity);
p.setBrush(st::radialBg);
p.setRenderHint(QPainter::HighQualityAntialiasing);
p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
{
PainterHighQualityEnabler hq(p);
p.drawEllipse(inner);
}
p.setOpacity(1);
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.setBrush(anim::brush(st::msgDateImgBg, st::msgDateImgBgOver, o));
p.setRenderHint(QPainter::HighQualityAntialiasing);
p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
{
PainterHighQualityEnabler hq(p);
p.drawEllipse(inner);
}
p.setOpacity(1.);
auto icon = ([radial, this]() -> const style::icon* {

View File

@ -63,7 +63,7 @@ overviewPhotoSelectOverlay: #40ace333;
overviewVideoBg: #000000;
overviewFileThumbBg: #000000;
overviewFileChecked: #2fa9e2;
overviewFileChecked: windowBgActive;
overviewFileCheck: #00000066;
overviewFileExtPadding: 5px;
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.setRenderHint(QPainter::HighQualityAntialiasing);
p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
{
PainterHighQualityEnabler hq(p);
p.drawEllipse(inner);
}
p.setOpacity((radial && loaded) ? _radial->opacity() : 1);
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.setRenderHint(QPainter::HighQualityAntialiasing);
p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
{
PainterHighQualityEnabler hq(p);
p.drawEllipse(inner);
}
if (radial) {
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.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));
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
{
PainterHighQualityEnabler hq(p);
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.setRenderHint(QPainter::HighQualityAntialiasing);
p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
{
PainterHighQualityEnabler hq(p);
p.drawEllipse(inner);
}
if (radial) {
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.setRenderHint(QPainter::HighQualityAntialiasing);
p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
{
PainterHighQualityEnabler hq(p);
p.drawEllipse(inner);
}
p.setOpacity(radialOpacity);
auto icon = ([loaded, this, selected] {
@ -1187,7 +1192,7 @@ void Link::paint(Painter &p, const QRect &clip, TextSelection selection, const P
top += h;
}
p.setPen(st::btnYesColor);
p.setPen(st::windowActiveTextFg);
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))) {
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;
profileMemberStatusFgOver: windowSubTextFgOver;
profileMemberStatusFgActive: windowActiveTextFg;
profileMemberAdminIcon: icon {{ "profile_admin_star", #3babe7, point(4px, 3px) }};
profileMemberAdminIcon: icon {{ "profile_admin_star", windowBgActive, point(4px, 3px) }};
profileLimitReachedLabel: FlatLabel(defaultFlatLabel) {
width: 180px;
margin: margins(profileMemberPaddingLeft, 9px, profileMemberPaddingLeft, 6px);
@ -141,6 +141,6 @@ profileReportReasonOther: InputArea(defaultInputArea) {
profileVerifiedCheckShift: -3px;
profileVerifiedCheck: icon {
{ "profile_verified_star", #4abcf1, point(0px, 7px) },
{ "profile_verified_check", #ffffff, point(4px, 11px) }
{ "profile_verified_star", windowBgActive, point(0px, 7px) },
{ "profile_verified_check", windowFgActive, point(4px, 11px) }
};

View File

@ -69,9 +69,10 @@ void BackgroundRow::paintEvent(QPaintEvent *e) {
p.setOpacity(radialOpacity);
p.setBrush(st::radialBg);
p.setRenderHint(QPainter::HighQualityAntialiasing);
p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
{
PainterHighQualityEnabler hq(p);
p.drawEllipse(inner);
}
p.setOpacity(1);
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);
back.setDevicePixelRatio(cRetinaFactor());
{
QPainter p(&back);
Painter p(&back);
PainterHighQualityEnabler hq(p);
auto &pix = Window::Theme::Background()->image();
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 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);
}
Images::prepareRound(back, ImageRoundRadius::Small);

View File

@ -69,6 +69,8 @@ CoverWidget::CoverWidget(QWidget *parent, UserData *self) : BlockWidget(parent,
validatePhoto();
refreshNameText();
subscribe(Global::RefConnectionTypeChanged(), [this] { refreshStatusText(); });
refreshStatusText();
}
@ -290,8 +292,14 @@ void CoverWidget::refreshStatusText() {
}
_cancelPhotoUpload.destroy();
_statusText = lang(lng_status_online);
_statusTextIsOnline = true;
auto state = MTP::dcstate();
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();
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -23,8 +23,8 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
namespace Ui {
void CrossAnimation::paint(QPainter &p, const style::CrossAnimation &st, const style::color &color, int x, int y, int outerWidth, float64 shown) {
p.setRenderHint(QPainter::HighQualityAntialiasing);
void CrossAnimation::paint(Painter &p, const style::CrossAnimation &st, const style::color &color, int x, int y, int outerWidth, float64 shown) {
PainterHighQualityEnabler hq(p);
auto deleteScale = shown + st.minScale * (1. - shown);
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]);
}
p.fillPath(path, color);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
}
} // namespace Ui

View File

@ -26,7 +26,7 @@ namespace Ui {
class CrossAnimation {
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;
}
p.setRenderHint(QPainter::HighQualityAntialiasing);
p.drawArc(inner, from, len);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
{
PainterHighQualityEnabler hq(p);
p.drawArc(inner, from, len);
}
p.setPen(was);
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 (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);
if (wasSmooth) p.setRenderHint(QPainter::SmoothPixmapTransform, false);
PainterHighQualityEnabler hq(p);
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 (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 (wasSmooth) p.setRenderHint(QPainter::SmoothPixmapTransform);
}
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);
{
Painter p(&_frame);
p.setRenderHint(QPainter::HighQualityAntialiasing);
p.setPen(Qt::NoPen);
if (colorOverride) {
p.setBrush(*colorOverride);
} else {
p.setBrush(_st.color);
}
p.drawEllipse(_origin, radius, radius);
{
PainterHighQualityEnabler hq(p);
p.drawEllipse(_origin, radius, radius);
}
p.setCompositionMode(QPainter::CompositionMode_DestinationIn);
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);
if (drawer) {
Painter p(&result);
p.setRenderHint(QPainter::HighQualityAntialiasing);
PainterHighQualityEnabler hq(p);
p.setPen(Qt::NoPen);
p.setBrush(QColor(255, 255, 255));
drawer(p);

View File

@ -34,7 +34,8 @@ void prepareCheckCaches(const style::RoundCheckbox *st, bool displayInactive, QP
cache.fill(Qt::transparent);
{
Painter p(&cache);
p.setRenderHint(QPainter::HighQualityAntialiasing, true);
PainterHighQualityEnabler hq(p);
if (displayInactive) {
p.setPen(Qt::NoPen);
} 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 displayInactive = !_inactiveCacheBg.isNull();
auto inactiveTo = cacheDestRect(x, y, masterScale);
p.setRenderHint(QPainter::SmoothPixmapTransform, true);
PainterHighQualityEnabler hq(p);
if (!_inactiveCacheBg.isNull()) {
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()) {
p.drawPixmap(inactiveTo, _inactiveCacheFg, cacheFrom);
}
p.setRenderHint(QPainter::SmoothPixmapTransform, false);
}
void RoundCheckbox::setChecked(bool newChecked, SetStyle speed) {
@ -201,7 +202,8 @@ void RoundCheckbox::prepareInactiveCache() {
auto cacheFg = cacheBg;
if (_st.bgInactive) {
Painter p(&cacheBg);
p.setRenderHint(QPainter::HighQualityAntialiasing, true);
PainterHighQualityEnabler hq(p);
p.setPen(Qt::NoPen);
p.setBrush(_st.bgInactive);
p.drawEllipse(ellipse);
@ -210,7 +212,8 @@ void RoundCheckbox::prepareInactiveCache() {
{
Painter p(&cacheFg);
p.setRenderHint(QPainter::HighQualityAntialiasing, true);
PainterHighQualityEnabler hq(p);
auto pen = _st.border->p;
pen.setWidth(_st.width);
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 from = QRect(QPoint(0, 0), _wideCache.size());
p.setRenderHint(QPainter::SmoothPixmapTransform, true);
PainterHighQualityEnabler hq(p);
p.drawPixmapLeft(to, outerWidth, _wideCache, from);
p.setRenderHint(QPainter::SmoothPixmapTransform, false);
} else {
if (!_wideCache.isNull()) {
_wideCache = QPixmap();
@ -254,7 +256,7 @@ void RoundImageCheckbox::paint(Painter &p, TimeMs ms, int x, int y, int outerWid
}
if (selectionLevel > 0) {
p.setRenderHint(QPainter::HighQualityAntialiasing, true);
PainterHighQualityEnabler hq(p);
p.setOpacity(snap(selectionLevel, 0., 1.));
p.setBrush(Qt::NoBrush);
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.drawEllipse(rtlrect(x, y, _st.imageRadius * 2, _st.imageRadius * 2, outerWidth));
p.setOpacity(1.);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
}
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 };
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.setBrush(color);
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);
frameMs = (frameMs + st::historySendActionTypingDuration - st::historySendActionTypingDeltaTime) % st::historySendActionTypingDuration;
}
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
}
class RecordAnimation : public SendActionAnimation::Impl {
@ -104,7 +103,7 @@ private:
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) {
p.setRenderHint(QPainter::HighQualityAntialiasing);
PainterHighQualityEnabler hq(p);
auto pen = color->p;
pen.setWidth(st::historySendActionRecordStrokeNumerator / st::historySendActionRecordDenominator);
pen.setJoinStyle(Qt::RoundJoin);
@ -121,7 +120,6 @@ void RecordAnimation::paintFrame(Painter &p, const style::color &color, int x, i
size += st::historySendActionRecordDelta;
}
p.setOpacity(1.);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
}
class UploadAnimation : public SendActionAnimation::Impl {
@ -149,7 +147,7 @@ private:
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) {
p.setRenderHint(QPainter::HighQualityAntialiasing);
PainterHighQualityEnabler hq(p);
auto pen = color->p;
pen.setWidth(st::historySendActionUploadStrokeNumerator / st::historySendActionUploadDenominator);
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.setOpacity(1.);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
p.translate(-position);
}

View File

@ -44,7 +44,8 @@ const QPixmap &circleMask(int width, int height) {
QImage mask(width, height, QImage::Format_ARGB32_Premultiplied);
{
Painter p(&mask);
p.setRenderHint(QPainter::HighQualityAntialiasing);
PainterHighQualityEnabler hq(p);
p.setCompositionMode(QPainter::CompositionMode_Source);
p.fillRect(0, 0, width, height, Qt::transparent);
p.setBrush(Qt::white);
@ -78,9 +79,10 @@ QImage prepareBlur(QImage img) {
if (withalpha) {
QImage imgsmall(w, h, img.format());
{
QPainter p(&imgsmall);
Painter p(&imgsmall);
PainterHighQualityEnabler hq(p);
p.setCompositionMode(QPainter::CompositionMode_Source);
p.setRenderHint(QPainter::SmoothPixmapTransform);
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));
}
@ -498,6 +500,29 @@ const QPixmap &Image::pixCircled(int32 w, int32 h) const {
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 {
checkload();

View File

@ -187,12 +187,13 @@ public:
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 &pixCircled(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 &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 &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 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;

View File

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

View File

@ -75,6 +75,40 @@ public:
void drawPixmapRight(const QPoint &p, int outerw, const QPixmap &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 \

View File

@ -141,15 +141,15 @@ void Checkbox::paintEvent(QPaintEvent *e) {
paintRipple(p, _st.rippleAreaPosition.x(), _st.rippleAreaPosition.y(), ms, &color);
if (_checkRect.intersects(e->rect())) {
p.setRenderHint(QPainter::HighQualityAntialiasing);
auto pen = anim::pen(_st.checkFg, _st.checkFgActive, active);
pen.setWidth(_st.thickness);
p.setPen(pen);
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) {
_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);
if (_checkRect.intersects(e->rect())) {
p.setRenderHint(QPainter::HighQualityAntialiasing);
PainterHighQualityEnabler hq(p);
auto pen = anim::pen(_st.checkFg, _st.checkFgActive, active);
pen.setWidth(_st.thickness);
@ -275,8 +275,6 @@ void Radiobutton::paintEvent(QPaintEvent *e) {
// }
//}
}
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
}
if (_checkRect.contains(e->rect())) return;

View File

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

View File

@ -1542,13 +1542,14 @@ void FlatInput::paintEvent(QPaintEvent *e) {
auto ms = getms();
auto placeholderFocused = _a_placeholderFocused.current(ms, hasFocus() ? 1. : 0.);
p.setRenderHint(QPainter::HighQualityAntialiasing);
auto pen = anim::pen(_st.borderColor, _st.borderActive, placeholderFocused);
pen.setWidth(_st.borderWidth);
p.setPen(pen);
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()) {
_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 clip = clipEnabled ? p.clipRegion() : QRegion();
p.setRenderHint(QPainter::HighQualityAntialiasing);
p.setClipRect(inner);
p.setPen(Qt::NoPen);
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) {
p.setClipRegion(clip);
} else {
p.setClipping(false);
}
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
auto overOpacity = _overOpacity.current(ms, _over ? 1. : 0.);
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.setBrush(_color);
p.setRenderHint(QPainter::HighQualityAntialiasing);
p.drawEllipse(rtlrect(x, y, _st.height, _st.height, outerWidth));
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
{
PainterHighQualityEnabler hq(p);
p.drawEllipse(rtlrect(x, y, _st.height, _st.height, outerWidth));
}
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) {
PainterHighQualityEnabler hq(p);
auto opacity = _visibility.current(_hiding ? 0. : 1.);
auto scale = opacity + _st.minScale * (1. - opacity);
auto height = opacity * _cache.height() / _cache.devicePixelRatio();
auto width = opacity * _cache.width() / _cache.devicePixelRatio();
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.setRenderHint(QPainter::SmoothPixmapTransform, false);
p.setOpacity(1.);
return true;
}

View File

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

View File

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

View File

@ -72,6 +72,8 @@ MainMenu::MainMenu(QWidget *parent) : TWidget(parent)
_version->setLink(2, MakeShared<LambdaClickHandler>([] { Ui::showLayer(new AboutBox()); }));
subscribe(FileDownload::ImageLoaded(), [this] { update(); });
subscribe(Global::RefConnectionTypeChanged(), [this] { updateConnectionState(); });
updateConnectionState();
}
void MainMenu::checkSelf() {
@ -110,6 +112,16 @@ void MainMenu::updateControlsGeometry() {
_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) {
Painter p(this);
auto clip = e->rect();
@ -121,7 +133,7 @@ void MainMenu::paintEvent(QPaintEvent *e) {
if (auto self = App::self()) {
self->nameText.drawLeftElided(p, st::mainMenuCoverTextLeft, st::mainMenuCoverNameTop, width() - 2 * st::mainMenuCoverTextLeft, width());
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);

View File

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

View File

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