Mixed channel access hash to the game score encrypted data.

Added new lang strings for playing game send actions (not done yet).
Also moved alot of icons from sprite to separate b&w files.
This commit is contained in:
John Preston 2016-09-30 15:52:03 +03:00
parent 828b42e4f1
commit 376941dd5e
77 changed files with 348 additions and 431 deletions

View File

@ -1,33 +0,0 @@
/*
This file is part of Telegram Desktop,
the official desktop version of Telegram messaging app, see https://telegram.org
Telegram Desktop is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
It is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
In addition, as a special exception, the copyright holders give permission
to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
// Legacy styles
using "basic_types.style";
using "basic.style";
using "boxes/boxes.style";
using "dialogs/dialogs.style";
using "history/history.style";
using "overview/overview.style";
using "profile/profile.style";
using "settings/settings.style";
using "media/view/mediaview.style";
using "ui/widgets/widgets.style";

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

After

Width:  |  Height:  |  Size: 108 KiB

View File

@ -248,9 +248,7 @@ defaultCheckbox: Checkbox {
textPosition: point(32px, 2px);
diameter: 22px;
thickness: 2px;
checkIcon: icon {
{ "default_checkbox_check", #ffffff, point(4px, 7px) }
};
checkIcon: icon {{ "default_checkbox_check", #ffffff, point(4px, 7px) }};
font: normalFont;
duration: 120;
@ -395,7 +393,7 @@ boxSearchCancel: iconedButton {
height: 48px;
}
titleBG: #6389a8;
titleBg: #6389a8;
titleColor: #0f8dcc;//rgb(20, 136, 210);
titleHeight: 39px;
titleIconPos: point(7px, 7px);
@ -443,47 +441,29 @@ btnDefIconed: iconedButton {
sysBtnDelta: 6px;
sysUpd: sysButton {
size: size(31px, 39px);
img: sprite(184px, 1px, 19px, 19px);
icon: icon {{ "title_button_update", titleBg }};
color: #c4d8e9;
overColor: white;
duration: 150;
}
updateBlinkDuration: 500;
sysMin: sysButton(sysUpd) {
img: sprite(207px, 1px, 19px, 19px);
icon: icon {{ "title_button_minimize", titleBg }};
}
sysMax: sysButton(sysUpd) {
img: sprite(230px, 1px, 19px, 19px);
icon: icon {{ "title_button_maximize", titleBg }};
}
sysRes: sysButton(sysUpd) {
img: sprite(253px, 1px, 19px, 19px);
icon: icon {{ "title_button_restore", titleBg }};
}
sysCls: sysButton(sysUpd) {
img: sprite(276px, 1px, 19px, 19px);
icon: icon {{ "title_button_close", titleBg }};
}
sysLock: sysButton(sysUpd) {
img: sprite(184px, 22px, 19px, 19px);
icon: icon {{ "title_button_lock", titleBg }};
}
sysUnlock: sysButton(sysUpd) {
img: sprite(207px, 22px, 19px, 19px);
}
titleBackButton: iconedButton(btnDefIconed) {
icon: sprite(9px, 104px, 13px, 20px);
iconPos: point(5px, 9px);
downIcon: sprite(9px, 104px, 13px, 20px);
downIconPos: point(5px, 10px);
bgColor: #c4d8e9;
overBgColor: #fff;
width: -30px;
height: 39px;
opacity: 1.;
cursor: cursor(default);
textPos: point(23px, 10px);
downTextPos: point(23px, 11px);
icon: icon {{ "title_button_unlock", titleBg }};
}
btnWhiteHover: #f5f5f5;
@ -809,18 +789,6 @@ noContactsHeight: 100px;
noContactsFont: font(fsize);
noContactsColor: #777;
dlgDblCheckImg: sprite(302px, 23px, 17px, 11px);
dlgCheckImg: sprite(320px, 23px, 17px, 11px);
dlgActiveDblCheckImg: sprite(302px, 36px, 17px, 11px);
dlgActiveCheckImg: sprite(320px, 36px, 17px, 11px);
dlgSendImg: sprite(122px, 25px, 17px, 11px);
dlgActiveSendImg: sprite(142px, 25px, 17px, 11px);
dlgChatImg: sprite(104px, 26px, 16px, 11px);
dlgActiveChatImg: sprite(104px, 37px, 16px, 11px);
dlgChannelImg: sprite(105px, 1px, 12px, 11px);
dlgActiveChannelImg: sprite(105px, 14px, 12px, 11px);
dlgFilter: flatInput(inpDefGray) {
font: font(fsize);
bgColor: #f2f2f2;
@ -952,9 +920,7 @@ msgReplyPadding: margins(6px, 6px, 11px, 6px);
msgReplyBarPos: point(1px, 0px);
msgReplyBarSize: size(2px, 36px);
msgReplyBarSkip: 10px;
msgOutReplyBarColor: #5dc452;
msgInReplyBarColor: #2fa9e2;
msgOutReplyBarSelColor: #4da79f;
msgInReplyBarSelColor: #2fa9e2;
msgBotKbDuration: 200;
@ -988,28 +954,7 @@ msgPtr: 8px;
msgBG: ":/gui/art/bg.jpg";
msgBG0: ":/gui/art/bg0.png";
msgCheckPos: point(3px, 1px);
msgSendingImg: sprite(260px, 20px, 20px, 20px);
msgCheckImg: sprite(320px, 0px, 20px, 20px);
msgDblCheckImg: sprite(300px, 0px, 20px, 20px);
msgSelectCheckImg: sprite(162px, 0px, 20px, 20px);
msgSelectDblCheckImg: sprite(142px, 0px, 20px, 20px);
msgViewsPos: point(0px, -4px);
msgViewsImg: sprite(104px, 48px, 16px, 11px);
msgSelectViewsImg: sprite(104px, 70px, 16px, 11px);
msgOutViewsImg: sprite(104px, 81px, 16px, 11px);
msgSelectOutViewsImg: sprite(104px, 92px, 16px, 11px);
msgSendingViewsImg: sprite(104px, 103px, 16px, 11px);
msgSendingOutViewsImg: sprite(104px, 125px, 16px, 11px);
msgInvSendingImg: sprite(320px, 65px, 20px, 20px);
msgInvCheckImg: sprite(280px, 20px, 20px, 20px);
msgInvDblCheckImg: sprite(300px, 65px, 20px, 20px);
msgInvViewsImg: sprite(104px, 59px, 16px, 11px);
msgInvSendingViewsImg: sprite(104px, 114px, 16px, 11px);
msgDateSpace: 12px;
msgDateCheckSpace: 4px;
msgDateViewsSpace: 11px;
msgDateDelta: point(2px, 5px);
msgDateImgDelta: 4px;
@ -1169,79 +1114,6 @@ msgFileOutBg: #78c67f;
msgFileOutBgOver: #6bc272;
msgFileOutBgSelected: #5fb389;
msgFileOutImage: icon {
{ "msg_file_image", msgOutBg },
};
msgFileOutImageSelected: icon {
{ "msg_file_image", msgOutBgSelected },
};
msgFileInImage: icon {
{ "msg_file_image", msgInBg },
};
msgFileInImageSelected: icon {
{ "msg_file_image", msgInBgSelected },
};
msgFileOutDocument: icon {
{ "msg_file_document", msgOutBg },
};
msgFileOutDocumentSelected: icon {
{ "msg_file_document", msgOutBgSelected },
};
msgFileInDocument: icon {
{ "msg_file_document", msgInBg },
};
msgFileInDocumentSelected: icon {
{ "msg_file_document", msgInBgSelected },
};
msgFileOutDownload: icon {
{ "msg_file_download", msgOutBg },
};
msgFileOutDownloadSelected: icon {
{ "msg_file_download", msgOutBgSelected },
};
msgFileInDownload: icon {
{ "msg_file_download", msgInBg },
};
msgFileInDownloadSelected: icon {
{ "msg_file_download", msgInBgSelected },
};
msgFileOutCancel: icon {
{ "msg_file_cancel", msgOutBg },
};
msgFileOutCancelSelected: icon {
{ "msg_file_cancel", msgOutBgSelected },
};
msgFileInCancel: icon {
{ "msg_file_cancel", msgInBg },
};
msgFileInCancelSelected: icon {
{ "msg_file_cancel", msgInBgSelected },
};
msgFileOutPause: icon {
{ "msg_file_pause", msgOutBg },
};
msgFileOutPauseSelected: icon {
{ "msg_file_pause", msgOutBgSelected },
};
msgFileInPause: icon {
{ "msg_file_pause", msgInBg },
};
msgFileInPauseSelected: icon {
{ "msg_file_pause", msgInBgSelected },
};
msgFileOutPlay: icon {
{ "msg_file_play", msgOutBg },
};
msgFileOutPlaySelected: icon {
{ "msg_file_play", msgOutBgSelected },
};
msgFileInPlay: icon {
{ "msg_file_play", msgInBg },
};
msgFileInPlaySelected: icon {
{ "msg_file_play", msgInBgSelected },
};
msgFileRed: sprite(0px, 425px, 20px, 20px);
msgFileYellow: sprite(20px, 425px, 20px, 20px);
msgFileGreen: sprite(40px, 425px, 20px, 20px);
@ -1673,9 +1545,7 @@ dropdownDef: dropdown {
width: 0px;
}
defaultInnerDropdownShadow: icon {
{ "dropdown_shadow", windowShadowFg },
};
defaultInnerDropdownShadow: icon {{ "dropdown_shadow", windowShadowFg }};
defaultInnerDropdown: InnerDropdown {
padding: margins(10px, 10px, 10px, 10px);
shadow: defaultInnerDropdownShadow;
@ -1909,10 +1779,6 @@ stickerPreviewDuration: 150;
stickerPreviewBg: #FFFFFFB0;
stickerPreviewMin: 0.1;
verifiedCheck: sprite(285px, 221px, 14px, 14px);
verifiedCheckInv: sprite(299px, 221px, 14px, 14px);
verifiedCheckPos: point(4px, 2px);
botKbDuration: 200;
botKbBg: #edf1f5;
botKbOverBg: #d8e2ec;
@ -2059,9 +1925,7 @@ mvCaptionRadius: 2px;
mvCaptionBg: #11111180;
mvCaptionFont: font(fsize);
medviewSaveMsgCheck: icon {
{ "mediaview_save_check", #ffffff }
};
medviewSaveMsgCheck: icon {{ "mediaview_save_check", #ffffff }};
medviewSaveMsgFont: font(16px);
medviewSaveMsgPadding: margins(55px, 19px, 29px, 20px);
medviewSaveMsgCheckPos: point(23px, 21px);

View File

@ -40,7 +40,7 @@ linkButton {
sysButton {
size: size;
img: sprite;
icon: icon;
color: color;
overColor: color;
duration: int;

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 433 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 660 B

View File

Before

Width:  |  Height:  |  Size: 268 B

After

Width:  |  Height:  |  Size: 268 B

View File

Before

Width:  |  Height:  |  Size: 401 B

After

Width:  |  Height:  |  Size: 401 B

View File

Before

Width:  |  Height:  |  Size: 170 B

After

Width:  |  Height:  |  Size: 170 B

View File

Before

Width:  |  Height:  |  Size: 281 B

After

Width:  |  Height:  |  Size: 281 B

View File

Before

Width:  |  Height:  |  Size: 174 B

After

Width:  |  Height:  |  Size: 174 B

View File

Before

Width:  |  Height:  |  Size: 419 B

After

Width:  |  Height:  |  Size: 419 B

View File

Before

Width:  |  Height:  |  Size: 289 B

After

Width:  |  Height:  |  Size: 289 B

View File

Before

Width:  |  Height:  |  Size: 468 B

After

Width:  |  Height:  |  Size: 468 B

View File

Before

Width:  |  Height:  |  Size: 118 B

After

Width:  |  Height:  |  Size: 118 B

View File

Before

Width:  |  Height:  |  Size: 165 B

After

Width:  |  Height:  |  Size: 165 B

View File

Before

Width:  |  Height:  |  Size: 242 B

After

Width:  |  Height:  |  Size: 242 B

View File

Before

Width:  |  Height:  |  Size: 417 B

After

Width:  |  Height:  |  Size: 417 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1000 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 557 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 B

View File

@ -772,12 +772,12 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_allow_bot" = "Allow";
"lng_bot_start" = "Start";
"lng_bot_choose_group" = "Choose Group";
"lng_bot_choose_group" = "Select a Group";
"lng_bot_no_groups" = "You have no groups";
"lng_bot_groups_not_found" = "No groups found";
"lng_bot_sure_invite" = "Add the bot to «{group}»?";
"lng_bot_already_in_group" = "The bot is already a member of the group.";
"lng_bot_choose_chat" = "Choose Chat";
"lng_bot_choose_chat" = "Select a Chat";
"lng_bot_no_chats" = "You have no chats";
"lng_bot_chats_not_found" = "No chats found";
"lng_bot_sure_share_game" = "Share the game with {user}?";
@ -787,6 +787,10 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
"lng_user_typing" = "{user} is typing";
"lng_users_typing" = "{user} and {second_user} are typing";
"lng_many_typing" = "{count:_not_used_|# is|# are} typing";
"lng_playing_game" = "playing game";
"lng_user_playing_game" = "{user} is playing game";
"lng_users_playing_game" = "{user} and {second_user} are playing game";
"lng_many_playing_game" = "{count:_not_used_|# is|# are} playing game";
"lng_send_action_record_video" = "recording a video";
"lng_user_action_record_video" = "{user} is recording a video";
"lng_send_action_upload_video" = "sending a video";

View File

@ -32,6 +32,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "apiwrap.h"
#include "observer_peer.h"
#include "styles/style_boxes.h"
#include "styles/style_dialogs.h"
AddContactBox::AddContactBox(QString fname, QString lname, QString phone) : AbstractBox(st::boxWidth)
, _save(this, lang(lng_add_contact), st::defaultBoxButton)
@ -1451,8 +1452,9 @@ void RevokePublicLinkBox::paintChat(Painter &p, const ChatRow &row, bool selecte
int32 namex = st::contactsPadding.left() + st::contactsPhotoSize + st::contactsPadding.left();
int32 namew = width() - namex - st::contactsPadding.right() - (_revokeWidth + st::contactsCheckPosition.x() * 2);
if (peer->isVerified()) {
namew -= st::verifiedCheck.pxWidth() + st::verifiedCheckPos.x();
p.drawSpriteLeft(namex + qMin(row.name.maxWidth(), namew) + st::verifiedCheckPos.x(), st::contactsPadding.top() + st::contactsNameTop + st::verifiedCheckPos.y(), width(), st::verifiedCheck);
auto icon = &st::dialogsVerifiedIcon;
namew -= icon->width();
icon->paint(p, namex + qMin(row.name.maxWidth(), namew), st::contactsPadding.top() + st::contactsNameTop, width());
}
row.name.drawLeftElided(p, namex, st::contactsPadding.top() + st::contactsNameTop, namew, width());

View File

@ -80,9 +80,7 @@ shareCheckBorder: windowBg;
shareCheckBg: windowActiveBg;
shareCheckRadius: 10px;
shareCheckSmallRadius: 3px;
shareCheckIcon: icon {
{ "default_checkbox_check", windowBg, point(3px, 6px) },
};
shareCheckIcon: icon {{ "default_checkbox_check", windowBg, point(3px, 6px) }};
shareNameFont: font(11px);
shareNameFg: windowTextFg;
shareNameActiveFg: btnYesColor;

View File

@ -22,6 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "boxes/contactsbox.h"
#include "dialogs/dialogs_indexed_list.h"
#include "styles/style_dialogs.h"
#include "lang.h"
#include "boxes/addcontactbox.h"
#include "mainwidget.h"
@ -435,8 +436,9 @@ void ContactsInner::paintDialog(Painter &p, PeerData *peer, ContactData *data, b
int32 iconw = (_chat || _creating != CreatingGroupNone) ? (st::contactsCheckPosition.x() * 2 + st::contactsCheckIcon.pxWidth()) : 0;
int32 namew = width() - namex - st::contactsPadding.right() - iconw;
if (peer->isVerified()) {
namew -= st::verifiedCheck.pxWidth() + st::verifiedCheckPos.x();
p.drawSpriteLeft(namex + qMin(data->name.maxWidth(), namew) + st::verifiedCheckPos.x(), st::contactsPadding.top() + st::contactsNameTop + st::verifiedCheckPos.y(), width(), st::verifiedCheck);
auto icon = &st::dialogsVerifiedIcon;
namew -= icon->width();
icon->paint(p, namex + qMin(data->name.maxWidth(), namew), st::contactsPadding.top() + st::contactsNameTop, width());
}
data->name.drawLeftElided(p, namex, st::contactsPadding.top() + st::contactsNameTop, namew, width());
@ -1942,8 +1944,9 @@ void MembersInner::paintDialog(Painter &p, PeerData *peer, MemberData *data, boo
int32 namex = st::contactsPadding.left() + st::contactsPhotoSize + st::contactsPadding.left();
int32 namew = width() - namex - st::contactsPadding.right() - (data->canKick ? (_kickWidth + st::contactsCheckPosition.x() * 2) : 0);
if (peer->isVerified()) {
namew -= st::verifiedCheck.pxWidth() + st::verifiedCheckPos.x();
p.drawSpriteLeft(namex + qMin(data->name.maxWidth(), namew) + st::verifiedCheckPos.x(), st::contactsPadding.top() + st::contactsNameTop + st::verifiedCheckPos.y(), width(), st::verifiedCheck);
auto icon = &st::dialogsVerifiedIcon;
namew -= icon->width();
icon->paint(p, namex + qMin(data->name.maxWidth(), namew), st::contactsPadding.top() + st::contactsNameTop, width());
}
data->name.drawLeftElided(p, namex, st::contactsPadding.top() + st::contactsNameTop, namew, width());

View File

@ -26,6 +26,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "mainwidget.h"
#include "photosendbox.h"
#include "history/history_media_types.h"
#include "styles/style_history.h"
PhotoSendBox::PhotoSendBox(const FileLoadResultPtr &file) : AbstractBox(st::boxWideWidth)
, _file(file)
@ -233,7 +234,7 @@ void PhotoSendBox::paintEvent(QPaintEvent *e) {
p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
auto icon = &st::msgFileInPlay;
auto icon = &st::historyFileInPlay;
icon->paintInCenter(p, inner);
}
} else {
@ -273,7 +274,7 @@ void PhotoSendBox::paintEvent(QPaintEvent *e) {
p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
auto icon = &(_isImage ? st::msgFileOutImage : st::msgFileOutDocument);
auto icon = &(_isImage ? st::historyFileOutImage : st::historyFileOutDocument);
icon->paintInCenter(p, inner);
} else {
p.drawPixmapLeft(x + st::msgFilePadding.left(), y + st::msgFilePadding.top(), width(), userDefPhoto(1)->pixCircled(st::msgFileSize));
@ -555,7 +556,7 @@ void EditCaptionBox::paintEvent(QPaintEvent *e) {
p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
auto icon = &st::msgFileInPlay;
auto icon = &st::historyFileInPlay;
icon->paintInCenter(p, inner);
}
} else if (_doc) {
@ -594,7 +595,7 @@ void EditCaptionBox::paintEvent(QPaintEvent *e) {
p.drawEllipse(inner);
p.setRenderHint(QPainter::HighQualityAntialiasing, false);
auto icon = &(_isImage ? st::msgFileInImage : st::msgFileInDocument);
auto icon = &(_isImage ? st::historyFileInImage : st::historyFileInDocument);
icon->paintInCenter(p, inner);
}
p.setFont(st::semiboldFont);

View File

@ -913,15 +913,24 @@ QVector<PeerData*> ShareInner::selected() const {
QString appendShareGameScoreUrl(const QString &url, const FullMsgId &fullId) {
auto shareHashData = QByteArray(0x10, Qt::Uninitialized);
auto ints = reinterpret_cast<int32*>(shareHashData.data());
ints[0] = MTP::authedId();
ints[1] = fullId.channel;
ints[2] = fullId.msg;
ints[3] = 0;
auto shareHashDataInts = reinterpret_cast<int32*>(shareHashData.data());
auto channel = fullId.channel ? App::channelLoaded(fullId.channel) : static_cast<ChannelData*>(nullptr);
auto channelAccessHash = channel ? channel->access : 0ULL;
auto channelAccessHashInts = reinterpret_cast<int32*>(&channelAccessHash);
shareHashDataInts[0] = MTP::authedId();
shareHashDataInts[1] = fullId.channel;
shareHashDataInts[2] = fullId.msg;
shareHashDataInts[3] = channelAccessHashInts[0];
// Count SHA1() of data.
auto key128Size = 0x10;
auto shareHashEncrypted = QByteArray(key128Size + shareHashData.size(), Qt::Uninitialized);
hashSha1(shareHashData.constData(), shareHashData.size(), shareHashEncrypted.data());
// Mix in channel access hash to the first 64 bits of SHA1 of data.
*reinterpret_cast<uint64*>(shareHashEncrypted.data()) ^= *reinterpret_cast<uint64*>(channelAccessHashInts);
// Encrypt data.
if (!Local::encrypt(shareHashData.constData(), shareHashEncrypted.data() + key128Size, shareHashData.size(), shareHashEncrypted.constData())) {
return url;
}
@ -1031,29 +1040,51 @@ void shareGameScoreByHash(const QString &hash) {
return;
}
// Decrypt data.
auto hashData = QByteArray(hashEncrypted.size() - key128Size, Qt::Uninitialized);
if (!Local::decrypt(hashEncrypted.constData() + key128Size, hashData.data(), hashEncrypted.size() - key128Size, hashEncrypted.constData())) {
return;
}
char checkSha1[20] = { 0 };
if (memcmp(hashSha1(hashData.constData(), hashData.size(), checkSha1), hashEncrypted.constData(), key128Size) != 0) {
Ui::showLayer(new InformBox(lang(lng_share_wrong_user)));
return;
}
auto ints = reinterpret_cast<int32*>(hashData.data());
if (ints[0] != MTP::authedId()) {
// Count SHA1() of data.
char dataSha1[20] = { 0 };
hashSha1(hashData.constData(), hashData.size(), dataSha1);
// Mix out channel access hash from the first 64 bits of SHA1 of data.
auto channelAccessHash = *reinterpret_cast<uint64*>(hashEncrypted.data()) ^ *reinterpret_cast<uint64*>(dataSha1);
// Check next 64 bits of SHA1() of data.
auto skipSha1Part = sizeof(channelAccessHash);
if (memcmp(dataSha1 + skipSha1Part, hashEncrypted.constData() + skipSha1Part, key128Size - skipSha1Part) != 0) {
Ui::showLayer(new InformBox(lang(lng_share_wrong_user)));
return;
}
auto hashDataInts = reinterpret_cast<int32*>(hashData.data());
if (hashDataInts[0] != MTP::authedId()) {
Ui::showLayer(new InformBox(lang(lng_share_wrong_user)));
return;
}
// Check first 32 bits of channel access hash.
auto channelAccessHashInts = reinterpret_cast<int32*>(&channelAccessHash);
if (channelAccessHashInts[0] != hashDataInts[3]) {
Ui::showLayer(new InformBox(lang(lng_share_wrong_user)));
return;
}
auto channelId = hashDataInts[1];
auto msgId = hashDataInts[2];
if (!channelId && channelAccessHash) {
// If there is no channel id, there should be no channel access_hash.
Ui::showLayer(new InformBox(lang(lng_share_wrong_user)));
return;
}
auto channelId = ints[1];
auto msgId = ints[2];
if (auto item = App::histItemById(channelId, msgId)) {
shareGameScoreFromItem(item);
} else if (App::api()) {
auto channel = channelId ? App::channelLoaded(channelId) : nullptr;
if (channel || !channelId) {
auto resolveMessageAndShareScore = [msgId](ChannelData *channel) {
App::api()->requestMessageData(channel, msgId, [](ChannelData *channel, MsgId msgId) {
if (auto item = App::histItemById(channel, msgId)) {
shareGameScoreFromItem(item);
@ -1061,6 +1092,22 @@ void shareGameScoreByHash(const QString &hash) {
Ui::showLayer(new InformBox(lang(lng_edit_deleted)));
}
});
};
auto channel = channelId ? App::channelLoaded(channelId) : nullptr;
if (channel || !channelId) {
resolveMessageAndShareScore(channel);
} else {
auto requestChannelIds = MTP_vector<MTPInputChannel>(1, MTP_inputChannel(MTP_int(channelId), MTP_long(channelAccessHash)));
auto requestChannel = MTPchannels_GetChannels(requestChannelIds);
MTP::send(requestChannel, rpcDone([channelId, resolveMessageAndShareScore](const MTPmessages_Chats &result) {
if (result.type() == mtpc_messages_chats) {
App::feedChats(result.c_messages_chats().vchats);
}
if (auto channel = App::channelLoaded(channelId)) {
resolveMessageAndShareScore(channel);
}
}));
}
}
}

View File

@ -63,14 +63,6 @@ dialogsScroll: flatScroll(scrollDef) {
bottomsh: 0px;
}
dialogsChatImgPos: point(1px, 4px);
dialogsChannelImgPos: point(3px, 4px);
dialogsImgSkip: 22px;
dialogsCheckLeft: 5px;
dialogsCheckTop: 4px;
dialogsCheckSkip: 3px;
dialogsTextStyle: textStyle(defaultTextStyle) {
linkFg: dialogsTextFgService;
linkFgDown: dialogsTextFgService;
@ -89,9 +81,7 @@ dialogsTextStyleDraftActive: textStyle(dialogsTextStyle) {
linkFgDown: #c6e1f7;
}
dialogsNewChatIcon: icon {
{ "dialogs_new_chat", #b7b7b7, point(9px, 10px) }
};
dialogsNewChatIcon: icon {{ "dialogs_new_chat", #b7b7b7, point(9px, 10px) }};
dialogsNewChatButton: RoundButton {
width: 36px;
height: 36px;
@ -108,6 +98,33 @@ dialogsNewChatButton: RoundButton {
textBgOver: transparent;
}
settingsEditIcon: icon {
{ "dialogs_new_chat", #b7b7b7, point(3px, 9px) }
dialogsChatTypeSkip: 22px;
dialogsChatIcon: icon {{ "dialogs_chat", #373737, point(1px, 4px) }};
dialogsChatActiveIcon: icon {{ "dialogs_chat", #ffffff, point(1px, 4px) }};
dialogsChannelIcon: icon {{ "dialogs_channel", #373737, point(3px, 4px) }};
dialogsChannelActiveIcon: icon {{ "dialogs_channel", #ffffff, point(3px, 4px) }};
dialogsSentStateFg: #5dc452;
dialogsSendStateSkip: 20px;
dialogsSendingIcon: icon {{ "dialogs_sending", #c1c1c1, point(8px, 4px) }};
dialogsSendingActiveIcon: icon {{ "dialogs_sending", #ffffff99, point(8px, 4px) }};
dialogsSentIcon: icon {{ "dialogs_sent", dialogsSentStateFg, point(10px, 4px) }};
dialogsSentActiveIcon: icon {{ "dialogs_sent", #ffffff, point(10px, 4px) }};
dialogsReceivedIcon: icon {{ "dialogs_received", dialogsSentStateFg, point(5px, 4px) }};
dialogsReceivedActiveIcon: icon {{ "dialogs_received", #ffffff, point(5px, 4px) }};
dialogsVerifiedIcon: icon {
{ "dialogs_verified_star", #4abcf1, point(4px, 2px) },
{ "dialogs_verified_check", #ffffff, point(7px, 7px) },
};
dialogsVerifiedActiveIcon: icon {
{ "dialogs_verified_star", #ffffff, point(4px, 2px) },
{ "dialogs_verified_check", #6a91b1, point(7px, 7px) },
};
historySendingIcon: icon {{ "dialogs_sending", #98d292, point(5px, 5px) }};
historySendingInvertedIcon: icon {{ "dialogs_sending", #ffffffc8, point(5px, 5px) }};
historyViewsSendingIcon: icon {{ "dialogs_sending", #a0adb5, point(3px, 0px) }};
historyViewsSendingInvertedIcon: icon {{ "dialogs_sending", #ffffffc8, point(3px, 0px) }};
settingsEditIcon: icon {{ "dialogs_new_chat", #b7b7b7, point(3px, 9px) }};

View File

@ -30,7 +30,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
namespace Dialogs {
namespace Layout {
namespace {
// Show all dates that are in the last 20 hours in time format.
@ -69,26 +68,15 @@ void paintRow(Painter &p, History *history, HistoryItem *item, Data::Draft *draf
int32 namewidth = w - nameleft - st::dialogsPadding.x();
QRect rectForName(nameleft, st::dialogsPadding.y() + st::dialogsNameTop, namewidth, st::msgNameFont->height);
// draw chat icon
if (history->peer->isChat() || history->peer->isMegagroup()) {
p.drawSprite(QPoint(rectForName.left() + st::dialogsChatImgPos.x(), rectForName.top() + st::dialogsChatImgPos.y()), (active ? st::dlgActiveChatImg : st::dlgChatImg));
rectForName.setLeft(rectForName.left() + st::dialogsImgSkip);
} else if (history->peer->isChannel()) {
p.drawSprite(QPoint(rectForName.left() + st::dialogsChannelImgPos.x(), rectForName.top() + st::dialogsChannelImgPos.y()), (active ? st::dlgActiveChannelImg : st::dlgChannelImg));
rectForName.setLeft(rectForName.left() + st::dialogsImgSkip);
if (auto chatTypeIcon = ChatTypeIcon(history->peer, active)) {
chatTypeIcon->paint(p, rectForName.topLeft(), w);
rectForName.setLeft(rectForName.left() + st::dialogsChatTypeSkip);
}
int texttop = st::dialogsPadding.y() + st::msgNameFont->height + st::dialogsSkip;
if (draft) {
paintRowDate(p, date, rectForName, active);
// draw check
if (draft->saveRequestId) {
auto check = active ? &st::dlgActiveSendImg : &st::dlgSendImg;
rectForName.setWidth(rectForName.width() - check->pxWidth() - st::dialogsCheckSkip);
p.drawSprite(QPoint(rectForName.left() + rectForName.width() + st::dialogsCheckLeft, rectForName.top() + st::dialogsCheckTop), *check);
}
p.setFont(st::dialogsTextFont);
p.setPen(active ? st::dialogsTextFgActive : st::dialogsTextFgService);
if (history->typing.isEmpty() && history->sendActions.isEmpty()) {
@ -116,28 +104,33 @@ void paintRow(Painter &p, History *history, HistoryItem *item, Data::Draft *draf
} else if (!item->isEmpty()) {
paintRowDate(p, date, rectForName, active);
// draw check
if (item->needCheck()) {
const style::sprite *check;
paintItemCallback(nameleft, namewidth, item);
}
auto sendStateIcon = ([draft, item, active]() -> const style::icon* {
if (draft) {
if (draft->saveRequestId) {
return &(active ? st::dialogsSendingActiveIcon : st::dialogsSendingIcon);
}
} else if (item && !item->isEmpty() && item->needCheck()) {
if (item->id > 0) {
if (item->unread()) {
check = active ? &st::dlgActiveCheckImg : &st::dlgCheckImg;
} else {
check = active ? &st::dlgActiveDblCheckImg : &st::dlgDblCheckImg;
return &(active ? st::dialogsSentActiveIcon : st::dialogsSentIcon);
}
} else {
check = active ? &st::dlgActiveSendImg : &st::dlgSendImg;
return &(active ? st::dialogsReceivedActiveIcon : st::dialogsReceivedIcon);
}
rectForName.setWidth(rectForName.width() - check->pxWidth() - st::dialogsCheckSkip);
p.drawSprite(QPoint(rectForName.left() + rectForName.width() + st::dialogsCheckLeft, rectForName.top() + st::dialogsCheckTop), *check);
return &(active ? st::dialogsSendingActiveIcon : st::dialogsSendingIcon);
}
paintItemCallback(nameleft, namewidth, item);
return nullptr;
})();
if (sendStateIcon) {
rectForName.setWidth(rectForName.width() - st::dialogsSendStateSkip);
sendStateIcon->paint(p, rectForName.topLeft() + QPoint(rectForName.width(), 0), w);
}
if (history->peer->isUser() && history->peer->isVerified()) {
rectForName.setWidth(rectForName.width() - st::verifiedCheck.pxWidth() - st::verifiedCheckPos.x());
p.drawSprite(rectForName.topLeft() + QPoint(qMin(history->peer->dialogName().maxWidth(), rectForName.width()), 0) + st::verifiedCheckPos, (active ? st::verifiedCheckInv : st::verifiedCheck));
auto icon = &(active ? st::dialogsVerifiedActiveIcon : st::dialogsVerifiedIcon);
rectForName.setWidth(rectForName.width() - icon->width());
icon->paint(p, rectForName.topLeft() + QPoint(qMin(history->peer->dialogName().maxWidth(), rectForName.width()), 0), w);
}
p.setPen(active ? st::dialogsTextFgActive : st::dialogsNameFg);
@ -169,6 +162,15 @@ QImage colorizeCircleHalf(UnreadBadgeSizeData *data, int size, int half, int xof
} // namepsace
const style::icon *ChatTypeIcon(PeerData *peer, bool active) {
if (peer->isChat() || peer->isMegagroup()) {
return &(active ? st::dialogsChatActiveIcon : st::dialogsChatIcon);
} else if (peer->isChannel()) {
return &(active ? st::dialogsChannelActiveIcon : st::dialogsChannelIcon);
}
return nullptr;
}
void paintUnreadBadge(Painter &p, const QRect &rect, const UnreadBadgeStyle &st) {
t_assert(rect.height() == st.size);

View File

@ -27,6 +27,8 @@ class FakeRow;
namespace Layout {
const style::icon *ChatTypeIcon(PeerData *peer, bool active);
class RowPainter {
public:
static void paint(Painter &p, const Row *row, int w, bool active, bool selected, bool onlyBackground);

View File

@ -253,16 +253,14 @@ void DialogsInner::peopleResultPaint(PeerData *peer, Painter &p, int32 w, bool a
QRect rectForName(nameleft, st::dialogsPadding.y() + st::dialogsNameTop, namewidth, st::msgNameFont->height);
// draw chat icon
if (peer->isChat() || peer->isMegagroup()) {
p.drawSprite(QPoint(rectForName.left() + st::dialogsChatImgPos.x(), rectForName.top() + st::dialogsChatImgPos.y()), (active ? st::dlgActiveChatImg : st::dlgChatImg));
rectForName.setLeft(rectForName.left() + st::dialogsImgSkip);
} else if (peer->isChannel()) {
p.drawSprite(QPoint(rectForName.left() + st::dialogsChannelImgPos.x(), rectForName.top() + st::dialogsChannelImgPos.y()), (active ? st::dlgActiveChannelImg : st::dlgChannelImg));
rectForName.setLeft(rectForName.left() + st::dialogsImgSkip);
if (auto chatTypeIcon = Dialogs::Layout::ChatTypeIcon(peer, active)) {
chatTypeIcon->paint(p, rectForName.topLeft(), w);
rectForName.setLeft(rectForName.left() + st::dialogsChatTypeSkip);
}
if (peer->isVerified()) {
rectForName.setWidth(rectForName.width() - st::verifiedCheck.pxWidth() - st::verifiedCheckPos.x());
p.drawSprite(rectForName.topLeft() + QPoint(qMin(peer->dialogName().maxWidth(), rectForName.width()), 0) + st::verifiedCheckPos, (active ? st::verifiedCheckInv : st::verifiedCheck));
auto icon = &(active ? st::dialogsVerifiedActiveIcon : st::dialogsVerifiedIcon);
rectForName.setWidth(rectForName.width() - icon->width());
icon->paint(p, rectForName.topLeft() + QPoint(qMin(peer->dialogName().maxWidth(), rectForName.width()), 0), w);
}
QRect tr(nameleft, st::dialogsPadding.y() + st::msgNameFont->height + st::dialogsSkip, namewidth, st::dialogsTextFont->height);
@ -300,13 +298,9 @@ void DialogsInner::searchInPeerPaint(Painter &p, int32 w, bool onlyBackground) c
int32 namewidth = w - nameleft - st::dialogsPadding.x() * 2 - st::btnCancelSearch.width;
QRect rectForName(nameleft, st::dialogsPadding.y() + st::dialogsNameTop, namewidth, st::msgNameFont->height);
// draw chat icon
if (_searchInPeer->isChat() || _searchInPeer->isMegagroup()) {
p.drawSprite(QPoint(rectForName.left() + st::dialogsChatImgPos.x(), rectForName.top() + st::dialogsChatImgPos.y()), st::dlgChatImg);
rectForName.setLeft(rectForName.left() + st::dialogsImgSkip);
} else if (_searchInPeer->isChannel()) {
p.drawSprite(QPoint(rectForName.left() + st::dialogsChannelImgPos.x(), rectForName.top() + st::dialogsChannelImgPos.y()), st::dlgChannelImg);
rectForName.setLeft(rectForName.left() + st::dialogsImgSkip);
if (auto chatTypeIcon = Dialogs::Layout::ChatTypeIcon(_searchInPeer, false)) {
chatTypeIcon->paint(p, rectForName.topLeft(), w);
rectForName.setLeft(rectForName.left() + st::dialogsChatTypeSkip);
}
QRect tr(nameleft, st::dialogsPadding.y() + st::msgNameFont->height + st::dialogsSkip, namewidth, st::dialogsTextFont->height);

View File

@ -19,6 +19,7 @@ Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
*/
using "basic.style";
using "dialogs/dialogs.style";
historyToDown: icon {
{ "history_down_shadow", #00000040 },
@ -45,3 +46,49 @@ membersInnerDropdown: InnerDropdown(defaultInnerDropdown) {
scrollMargin: margins(0px, 5px, 0px, 5px);
scrollPadding: margins(0px, 3px, 8px, 3px);
}
historyFileOutImage: icon {{ "history_file_image", msgOutBg }};
historyFileOutImageSelected: icon {{ "history_file_image", msgOutBgSelected }};
historyFileInImage: icon {{ "history_file_image", msgInBg }};
historyFileInImageSelected: icon {{ "history_file_image", msgInBgSelected }};
historyFileOutDocument: icon {{ "history_file_document", msgOutBg }};
historyFileOutDocumentSelected: icon {{ "history_file_document", msgOutBgSelected }};
historyFileInDocument: icon {{ "history_file_document", msgInBg }};
historyFileInDocumentSelected: icon {{ "history_file_document", msgInBgSelected }};
historyFileOutDownload: icon {{ "history_file_download", msgOutBg }};
historyFileOutDownloadSelected: icon {{ "history_file_download", msgOutBgSelected }};
historyFileInDownload: icon {{ "history_file_download", msgInBg }};
historyFileInDownloadSelected: icon {{ "history_file_download", msgInBgSelected }};
historyFileOutCancel: icon {{ "history_file_cancel", msgOutBg }};
historyFileOutCancelSelected: icon {{ "history_file_cancel", msgOutBgSelected }};
historyFileInCancel: icon {{ "history_file_cancel", msgInBg }};
historyFileInCancelSelected: icon {{ "history_file_cancel", msgInBgSelected }};
historyFileOutPause: icon {{ "history_file_pause", msgOutBg }};
historyFileOutPauseSelected: icon {{ "history_file_pause", msgOutBgSelected }};
historyFileInPause: icon {{ "history_file_pause", msgInBg }};
historyFileInPauseSelected: icon {{ "history_file_pause", msgInBgSelected }};
historyFileOutPlay: icon {{ "history_file_play", msgOutBg }};
historyFileOutPlaySelected: icon {{ "history_file_play", msgOutBgSelected }};
historyFileInPlay: icon {{ "history_file_play", msgInBg }};
historyFileInPlaySelected: icon {{ "history_file_play", msgInBgSelected }};
historyOutFg: dialogsSentStateFg;
historyOutSelectedFg: #4da79f;
historyInvertedFg: #ffffff;
historySendStateSpace: 24px;
historySendStatePosition: point(-17px, -19px);
historySentIcon: icon {{ "history_sent", historyOutFg, point(2px, 4px) }};
historySentSelectedIcon: icon {{ "history_sent", historyOutSelectedFg, point(2px, 4px) }};
historySentInvertedIcon: icon {{ "history_sent", historyInvertedFg, point(2px, 4px) }};
historyReceivedIcon: icon {{ "history_received", historyOutFg, point(2px, 4px) }};
historyReceivedSelectedIcon: icon {{ "history_received", historyOutSelectedFg, point(2px, 4px) }};
historyReceivedInvertedIcon: icon {{ "history_received", historyInvertedFg, point(2px, 4px) }};
historyViewsSpace: 11px;
historyViewsWidth: 20px;
historyViewsTop: -15px;
historyViewsInIcon: icon {{ "history_views", #a0acb6 }};
historyViewsInSelectedIcon: icon {{ "history_views", #6a9bc5 }};
historyViewsOutIcon: icon {{ "history_views", historyOutFg }};
historyViewsOutSelectedIcon: icon {{ "history_views", historyOutSelectedFg }};
historyViewsInvertedIcon: icon {{ "history_views", #ffffffe6 }};

View File

@ -32,6 +32,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "boxes/addcontactbox.h"
#include "core/click_handler_types.h"
#include "history/history_location_manager.h"
#include "styles/style_history.h"
namespace {
@ -436,11 +437,11 @@ void HistoryPhoto::draw(Painter &p, const QRect &r, TextSelection selection, uin
if (radial || _data->loading()) {
auto delayed = _data->full->toDelayedStorageImage();
if (!delayed || !delayed->location().isNull()) {
return &(selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel);
}
return nullptr;
}
return &(selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload);
})();
if (icon) {
icon->paintInCenter(p, inner);
@ -772,11 +773,11 @@ void HistoryVideo::draw(Painter &p, const QRect &r, TextSelection selection, uin
auto icon = ([loaded, radial, this, selected] {
if (loaded) {
return &(selected ? st::msgFileInPlaySelected : st::msgFileInPlay);
return &(selected ? st::historyFileInPlaySelected : st::historyFileInPlay);
} else if (radial || _data->loading()) {
return &(selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel);
}
return &(selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload);
})();
icon->paintInCenter(p, inner);
if (radial) {
@ -1125,9 +1126,9 @@ void HistoryDocument::draw(Painter &p, const QRect &r, TextSelection selection,
p.setOpacity(radialOpacity);
auto icon = ([radial, this, selected] {
if (radial || _data->loading()) {
return &(selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel);
}
return &(selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload);
})();
p.setOpacity((radial && loaded) ? _animation->radial.opacity() : 1);
icon->paintInCenter(p, inner);
@ -1177,18 +1178,18 @@ void HistoryDocument::draw(Painter &p, const QRect &r, TextSelection selection,
auto icon = ([showPause, radial, this, loaded, outbg, selected] {
if (showPause) {
return &(outbg ? (selected ? st::msgFileOutPauseSelected : st::msgFileOutPause) : (selected ? st::msgFileInPauseSelected : st::msgFileInPause));
return &(outbg ? (selected ? st::historyFileOutPauseSelected : st::historyFileOutPause) : (selected ? st::historyFileInPauseSelected : st::historyFileInPause));
} else if (radial || _data->loading()) {
return &(outbg ? (selected ? st::msgFileOutCancelSelected : st::msgFileOutCancel) : (selected ? st::msgFileInCancelSelected : st::msgFileInCancel));
return &(outbg ? (selected ? st::historyFileOutCancelSelected : st::historyFileOutCancel) : (selected ? st::historyFileInCancelSelected : st::historyFileInCancel));
} else if (loaded) {
if (_data->song() || _data->voice()) {
return &(outbg ? (selected ? st::msgFileOutPlaySelected : st::msgFileOutPlay) : (selected ? st::msgFileInPlaySelected : st::msgFileInPlay));
return &(outbg ? (selected ? st::historyFileOutPlaySelected : st::historyFileOutPlay) : (selected ? st::historyFileInPlaySelected : st::historyFileInPlay));
} else if (_data->isImage()) {
return &(outbg ? (selected ? st::msgFileOutImageSelected : st::msgFileOutImage) : (selected ? st::msgFileInImageSelected : st::msgFileInImage));
return &(outbg ? (selected ? st::historyFileOutImageSelected : st::historyFileOutImage) : (selected ? st::historyFileInImageSelected : st::historyFileInImage));
}
return &(outbg ? (selected ? st::msgFileOutDocumentSelected : st::msgFileOutDocument) : (selected ? st::msgFileInDocumentSelected : st::msgFileInDocument));
return &(outbg ? (selected ? st::historyFileOutDocumentSelected : st::historyFileOutDocument) : (selected ? st::historyFileInDocumentSelected : st::historyFileInDocument));
}
return &(outbg ? (selected ? st::msgFileOutDownloadSelected : st::msgFileOutDownload) : (selected ? st::msgFileInDownloadSelected : st::msgFileInDownload));
return &(outbg ? (selected ? st::historyFileOutDownloadSelected : st::historyFileOutDownload) : (selected ? st::historyFileInDownloadSelected : st::historyFileInDownload));
})();
icon->paintInCenter(p, inner);
}
@ -1748,14 +1749,14 @@ void HistoryGif::draw(Painter &p, const QRect &r, TextSelection selection, uint6
p.setOpacity(radialOpacity);
auto icon = ([this, radial, selected]() -> const style::icon * {
if (_data->loaded() && !radial) {
return &(selected ? st::msgFileInPlaySelected : st::msgFileInPlay);
return &(selected ? st::historyFileInPlaySelected : st::historyFileInPlay);
} else if (radial || _data->loading()) {
if (_parent->id > 0 || _data->uploading()) {
return &(selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel);
}
return nullptr;
}
return &(selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload);
})();
if (icon) {
icon->paintInCenter(p, inner);
@ -2652,7 +2653,7 @@ void HistoryWebPage::draw(Painter &p, const QRect &r, TextSelection selection, u
bool out = _parent->out(), isPost = _parent->isPost(), outbg = out && !isPost;
bool selected = (selection == FullSelection);
style::color barfg = (selected ? (outbg ? st::msgOutReplyBarSelColor : st::msgInReplyBarSelColor) : (outbg ? st::msgOutReplyBarColor : st::msgInReplyBarColor));
style::color barfg = (selected ? (outbg ? st::historyOutSelectedFg : st::msgInReplyBarSelColor) : (outbg ? st::historyOutFg : st::msgInReplyBarColor));
style::color semibold = (selected ? (outbg ? st::msgOutServiceFgSelected : st::msgInServiceFgSelected) : (outbg ? st::msgOutServiceFg : st::msgInServiceFg));
style::color regular = (selected ? (outbg ? st::msgOutDateFgSelected : st::msgInDateFgSelected) : (outbg ? st::msgOutDateFg : st::msgInDateFg));
@ -3051,7 +3052,7 @@ void HistoryGame::draw(Painter &p, const QRect &r, TextSelection selection, uint
bool out = _parent->out(), isPost = _parent->isPost(), outbg = out && !isPost;
bool selected = (selection == FullSelection);
style::color barfg = (selected ? (outbg ? st::msgOutReplyBarSelColor : st::msgInReplyBarSelColor) : (outbg ? st::msgOutReplyBarColor : st::msgInReplyBarColor));
style::color barfg = (selected ? (outbg ? st::historyOutSelectedFg : st::msgInReplyBarSelColor) : (outbg ? st::historyOutFg : st::msgInReplyBarColor));
style::color semibold = (selected ? (outbg ? st::msgOutServiceFgSelected : st::msgInServiceFgSelected) : (outbg ? st::msgOutServiceFg : st::msgInServiceFg));
style::color regular = (selected ? (outbg ? st::msgOutDateFgSelected : st::msgInDateFgSelected) : (outbg ? st::msgOutDateFg : st::msgInDateFg));

View File

@ -29,6 +29,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "history/history_service_layout.h"
#include "history/history_media_types.h"
#include "styles/style_dialogs.h"
#include "styles/style_history.h"
namespace {
@ -244,7 +245,7 @@ void HistoryMessageReply::paint(Painter &p, const HistoryItem *holder, int x, in
style::color bar;
if (flags & PaintInBubble) {
bar = ((flags & PaintSelected) ? (outbg ? st::msgOutReplyBarSelColor : st::msgInReplyBarSelColor) : (outbg ? st::msgOutReplyBarColor : st::msgInReplyBarColor));
bar = ((flags & PaintSelected) ? (outbg ? st::historyOutSelectedFg : st::msgInReplyBarSelColor) : (outbg ? st::historyOutFg : st::msgInReplyBarColor));
} else {
bar = st::white;
}
@ -338,8 +339,8 @@ void HistoryMessage::KeyboardStyle::paintButtonIcon(Painter &p, const QRect &rec
}
void HistoryMessage::KeyboardStyle::paintButtonLoading(Painter &p, const QRect &rect) const {
style::sprite sprite = st::msgInvSendingImg;
p.drawSprite(rect.x() + rect.width() - sprite.pxWidth() - st::msgBotKbIconPadding, rect.y() + rect.height() - sprite.pxHeight() - st::msgBotKbIconPadding, sprite);
auto icon = &st::historySendingInvertedIcon;
icon->paint(p, rect.x() + rect.width() - icon->width() - st::msgBotKbIconPadding, rect.y() + rect.height() - icon->height() - st::msgBotKbIconPadding, rect.x() * 2 + rect.width());
}
int HistoryMessage::KeyboardStyle::minButtonWidth(HistoryMessageReplyMarkup::Button::Type type) const {
@ -352,7 +353,7 @@ int HistoryMessage::KeyboardStyle::minButtonWidth(HistoryMessageReplyMarkup::But
case Button::Type::SwitchInlineSame:
case Button::Type::SwitchInline: iconWidth = st::msgBotKbSwitchPmIcon.pxWidth(); break;
case Button::Type::Callback:
case Button::Type::Game: iconWidth = st::msgInvSendingImg.pxWidth(); break;
case Button::Type::Game: iconWidth = st::historySendingInvertedIcon.width(); break;
}
if (iconWidth > 0) {
result = std::max(result, 2 * iconWidth + 4 * int(st::msgBotKbIconPadding));
@ -1076,6 +1077,28 @@ bool HistoryMessage::textHasLinks() const {
return emptyText() ? false : _text.hasLinks();
}
int HistoryMessage::infoWidth() const {
int result = _timeWidth;
if (auto views = Get<HistoryMessageViews>()) {
result += st::historyViewsSpace + views->_viewsWidth + st::historyViewsWidth;
} else if (id < 0 && history()->peer->isSelf()) {
result += st::historySendStateSpace;
}
if (out() && !isPost()) {
result += st::historySendStateSpace;
}
return result;
}
int HistoryMessage::timeLeft() const {
int result = 0;
if (auto views = Get<HistoryMessageViews>()) {
result += st::historyViewsSpace + views->_viewsWidth + st::historyViewsWidth;
} else if (id < 0 && history()->peer->isSelf()) {
result += st::historySendStateSpace;
}
return result;
}
void HistoryMessage::drawInfo(Painter &p, int32 right, int32 bottom, int32 width, bool selected, InfoDisplayType type) const {
p.setFont(st::msgDateFont);
@ -1122,43 +1145,38 @@ void HistoryMessage::drawInfo(Painter &p, int32 right, int32 bottom, int32 width
p.drawText(dateX, dateY + st::msgDateFont->ascent, _timeText);
}
QPoint iconPos;
const style::sprite *iconRect = nullptr;
if (auto views = Get<HistoryMessageViews>()) {
iconPos = QPoint(infoRight - infoW + st::msgViewsPos.x(), infoBottom - st::msgViewsImg.pxHeight() + st::msgViewsPos.y());
auto icon = ([this, outbg, invertedsprites, selected] {
if (id > 0) {
if (outbg) {
return &(invertedsprites ? st::historyViewsInvertedIcon : (selected ? st::historyViewsOutSelectedIcon : st::historyViewsOutIcon));
}
return &(invertedsprites ? st::historyViewsInvertedIcon : (selected ? st::historyViewsInSelectedIcon : st::historyViewsInIcon));
}
return &(invertedsprites ? st::historyViewsSendingInvertedIcon : st::historyViewsSendingIcon);
})();
if (id > 0) {
if (outbg) {
iconRect = &(invertedsprites ? st::msgInvViewsImg : (selected ? st::msgSelectOutViewsImg : st::msgOutViewsImg));
} else {
iconRect = &(invertedsprites ? st::msgInvViewsImg : (selected ? st::msgSelectViewsImg : st::msgViewsImg));
}
p.drawText(iconPos.x() + st::msgViewsImg.pxWidth() + st::msgDateCheckSpace, infoBottom - st::msgDateFont->descent, views->_viewsText);
} else {
iconPos.setX(iconPos.x() + st::msgDateViewsSpace + views->_viewsWidth);
if (outbg) {
iconRect = &(invertedsprites ? st::msgInvSendingViewsImg : st::msgSendingOutViewsImg);
} else {
iconRect = &(invertedsprites ? st::msgInvSendingViewsImg : st::msgSendingViewsImg);
}
icon->paint(p, infoRight - infoW, infoBottom + st::historyViewsTop, width);
p.drawText(infoRight - infoW + st::historyViewsWidth, infoBottom - st::msgDateFont->descent, views->_viewsText);
} else if (!outbg) { // sending outbg icon will be painted below
auto iconSkip = st::historyViewsSpace + views->_viewsWidth;
icon->paint(p, infoRight - infoW + iconSkip, infoBottom + st::historyViewsTop, width);
}
p.drawSprite(iconPos, *iconRect);
} else if (id < 0 && history()->peer->isSelf()) {
iconPos = QPoint(infoRight - infoW, infoBottom - st::msgViewsImg.pxHeight() + st::msgViewsPos.y());
iconRect = &(invertedsprites ? st::msgInvSendingViewsImg : st::msgSendingViewsImg);
p.drawSprite(iconPos, *iconRect);
auto icon = &(invertedsprites ? st::historyViewsSendingInvertedIcon : st::historyViewsSendingIcon);
icon->paint(p, infoRight - infoW, infoBottom + st::historyViewsTop, width);
}
if (outbg) {
iconPos = QPoint(infoRight - st::msgCheckImg.pxWidth() + st::msgCheckPos.x(), infoBottom - st::msgCheckImg.pxHeight() + st::msgCheckPos.y());
if (id > 0) {
if (unread()) {
iconRect = &(invertedsprites ? st::msgInvCheckImg : (selected ? st::msgSelectCheckImg : st::msgCheckImg));
} else {
iconRect = &(invertedsprites ? st::msgInvDblCheckImg : (selected ? st::msgSelectDblCheckImg : st::msgDblCheckImg));
auto icon = ([this, invertedsprites, selected] {
if (id > 0) {
if (unread()) {
return &(invertedsprites ? st::historySentInvertedIcon : (selected ? st::historySentSelectedIcon : st::historySentIcon));
}
return &(invertedsprites ? st::historyReceivedInvertedIcon : (selected ? st::historyReceivedSelectedIcon : st::historyReceivedIcon));
}
} else {
iconRect = &(invertedsprites ? st::msgInvSendingImg : st::msgSendingImg);
}
p.drawSprite(iconPos, *iconRect);
return &(invertedsprites ? st::historySendingInvertedIcon : st::historySendingIcon);
})();
icon->paint(p, QPoint(infoRight, infoBottom) + st::historySendStatePosition, width);
}
}

View File

@ -105,33 +105,14 @@ public:
TextWithEntities originalText() const override;
bool textHasLinks() const override;
int32 infoWidth() const override {
int32 result = _timeWidth;
if (const HistoryMessageViews *views = Get<HistoryMessageViews>()) {
result += st::msgDateViewsSpace + views->_viewsWidth + st::msgDateCheckSpace + st::msgViewsImg.pxWidth();
} else if (id < 0 && history()->peer->isSelf()) {
result += st::msgDateCheckSpace + st::msgCheckImg.pxWidth();
}
if (out() && !isPost()) {
result += st::msgDateCheckSpace + st::msgCheckImg.pxWidth();
}
return result;
}
int32 timeLeft() const override {
int32 result = 0;
if (const HistoryMessageViews *views = Get<HistoryMessageViews>()) {
result += st::msgDateViewsSpace + views->_viewsWidth + st::msgDateCheckSpace + st::msgViewsImg.pxWidth();
} else if (id < 0 && history()->peer->isSelf()) {
result += st::msgDateCheckSpace + st::msgCheckImg.pxWidth();
}
return result;
}
int32 timeWidth() const override {
int infoWidth() const override;
int timeLeft() const override;
int timeWidth() const override {
return _timeWidth;
}
int32 viewsCount() const override {
if (const HistoryMessageViews *views = Get<HistoryMessageViews>()) {
int viewsCount() const override {
if (auto views = Get<HistoryMessageViews>()) {
return views->_views;
}
return HistoryItem::viewsCount();

View File

@ -22,6 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "inline_bots/inline_bot_layout_internal.h"
#include "styles/style_overview.h"
#include "styles/style_history.h"
#include "inline_bots/inline_bot_result.h"
#include "media/media_clip_reader.h"
#include "history/history_location_manager.h"
@ -179,11 +180,11 @@ void Gif::paint(Painter &p, const QRect &clip, const PaintContext *context) cons
p.setOpacity(radialOpacity);
auto icon = ([loaded, radial, loading] {
if (loaded && !radial) {
return &st::msgFileInPlay;
return &st::historyFileInPlay;
} else if (radial || loading) {
return &st::msgFileInCancel;
return &st::historyFileInCancel;
}
return &st::msgFileInDownload;
return &st::historyFileInDownload;
})();
QRect inner((_width - st::msgFileSize) / 2, (height - st::msgFileSize) / 2, st::msgFileSize, st::msgFileSize);
icon->paintInCenter(p, inner);
@ -723,18 +724,18 @@ void File::paint(Painter &p, const QRect &clip, const PaintContext *context) con
auto icon = ([showPause, radial, document] {
if (showPause) {
return &st::msgFileInPause;
return &st::historyFileInPause;
} else if (radial || document->loading()) {
return &st::msgFileInCancel;
return &st::historyFileInCancel;
} else if (true || document->loaded()) {
if (document->isImage()) {
return &st::msgFileInImage;
return &st::historyFileInImage;
} else if (document->voice() || document->song()) {
return &st::msgFileInPlay;
return &st::historyFileInPlay;
}
return &st::msgFileInDocument;
return &st::historyFileInDocument;
}
return &st::msgFileInDownload;
return &st::historyFileInDownload;
})();
icon->paintInCenter(p, inner);

View File

@ -220,7 +220,6 @@ void LayerStackWidget::startHide() {
if (isHidden() || _hiding) {
return;
}
_hiding = true;
startAnimation(0);
}
@ -653,13 +652,11 @@ QPixmap MediaPreviewWidget::currentImage() const {
if (_cacheStatus != CacheLoaded) {
if (_photo->full->loaded()) {
QSize s = currentDimensions();
LOG(("DIMENSIONS: %1 %2").arg(s.width()).arg(s.height()));
_cache = _photo->full->pix(s.width(), s.height());
_cacheStatus = CacheLoaded;
} else {
if (_cacheStatus != CacheThumbLoaded && _photo->thumb->loaded()) {
QSize s = currentDimensions();
LOG(("DIMENSIONS: %1 %2").arg(s.width()).arg(s.height()));
_cache = _photo->thumb->pixBlurred(s.width(), s.height());
_cacheStatus = CacheThumbLoaded;
}

View File

@ -21,6 +21,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "stdafx.h"
#include "mainwindow.h"
#include "dialogs/dialogs_layout.h"
#include "styles/style_dialogs.h"
#include "zip.h"
#include "lang.h"
@ -182,12 +183,9 @@ void NotifyWindow::updateNotifyDisplay() {
QRect rectForName(st::notifyPhotoPos.x() + st::notifyPhotoSize + st::notifyTextLeft, st::notifyTextTop, itemWidth, st::msgNameFont->height);
if (!App::passcoded() && Global::NotifyView() <= dbinvShowName) {
if (history->peer->isChat() || history->peer->isMegagroup()) {
p.drawSprite(QPoint(rectForName.left() + st::dialogsChatImgPos.x(), rectForName.top() + st::dialogsChatImgPos.y()), st::dlgChatImg);
rectForName.setLeft(rectForName.left() + st::dialogsImgSkip);
} else if (history->peer->isChannel()) {
p.drawSprite(QPoint(rectForName.left() + st::dialogsChannelImgPos.x(), rectForName.top() + st::dialogsChannelImgPos.y()), st::dlgChannelImg);
rectForName.setLeft(rectForName.left() + st::dialogsImgSkip);
if (auto chatTypeIcon = Dialogs::Layout::ChatTypeIcon(history->peer, false)) {
chatTypeIcon->paint(p, rectForName.topLeft(), w);
rectForName.setLeft(rectForName.left() + st::dialogsChatTypeSkip);
}
}

View File

@ -39,31 +39,23 @@ mediaviewPlayButton: IconButton {
opacity: mediaviewInactiveOpacity;
overOpacity: mediaviewActiveOpacity;
icon: icon {
{ "media_play", #ffffff, point(3px, 0px) },
};
icon: icon {{ "media_play", #ffffff, point(3px, 0px) }};
iconPosition: point(3px, 1px);
downIconPosition: point(3px, 1px);
duration: mediaviewOverDuration;
}
mediaviewPauseIcon: icon {
{ "media_pause", #ffffff, point(1px, 1px) }
};
mediaviewPauseIcon: icon {{ "media_pause", #ffffff, point(1px, 1px) }};
mediaviewPlayPauseLeft: 17px;
mediaviewFullScreenLeft: 17px;
mediaviewVolumeLeft: 15px;
mediaviewFullScreenButton: IconButton(mediaviewPlayButton) {
icon: icon {
{ "media_fullscreen_to", #ffffff, point(0px, 0px) },
};
icon: icon {{ "media_fullscreen_to", #ffffff, point(0px, 0px) }};
iconPosition: point(0px, 1px);
downIconPosition: point(0px, 1px);
}
mediaviewFullScreenOutIcon: icon {
{ "media_fullscreen_from", #ffffff, point(0px, 0px) },
};
mediaviewFullScreenOutIcon: icon {{ "media_fullscreen_from", #ffffff, point(0px, 0px) }};
mediaviewPlaybackActive: #ffffff;
mediaviewPlaybackInactive: #474747;
@ -72,11 +64,7 @@ mediaviewPlaybackTop: 28px;
mediaviewSeekSize: size(11px, 11px);
mediaviewVolumeSize: size(44px, 20px);
mediaviewVolumeIcon: icon {
{ "media_volume", mediaviewPlaybackInactive, point(0px, 0px) },
};
mediaviewVolumeOnIcon: icon {
{ "media_volume", mediaviewPlaybackActive, point(0px, 0px) },
};
mediaviewVolumeIcon: icon {{ "media_volume", mediaviewPlaybackInactive, point(0px, 0px) }};
mediaviewVolumeOnIcon: icon {{ "media_volume", mediaviewPlaybackActive, point(0px, 0px) }};
mediaviewVolumeIconTop: 8px;
mediaviewControllerRadius: 25px;

View File

@ -22,6 +22,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "overview/overview_layout.h"
#include "styles/style_overview.h"
#include "styles/style_history.h"
#include "ui/filedialog.h"
#include "boxes/addcontactbox.h"
#include "boxes/confirmbox.h"
@ -335,11 +336,11 @@ void Video::paint(Painter &p, const QRect &clip, TextSelection selection, const
p.setOpacity((radial && loaded) ? _radial->opacity() : 1);
auto icon = ([radial, loaded, selected] {
if (radial) {
return &(selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel);
} else if (loaded) {
return &(selected ? st::msgFileInPlaySelected : st::msgFileInPlay);
return &(selected ? st::historyFileInPlaySelected : st::historyFileInPlay);
}
return &(selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload);
})();
icon->paintInCenter(p, inner);
if (radial) {
@ -463,13 +464,13 @@ void Voice::paint(Painter &p, const QRect &clip, TextSelection selection, const
auto icon = ([showPause, this, selected] {
if (showPause) {
return &(selected ? st::msgFileInPauseSelected : st::msgFileInPause);
return &(selected ? st::historyFileInPauseSelected : st::historyFileInPause);
} else if (_statusSize < 0 || _statusSize == FileStatusSizeLoaded) {
return &(selected ? st::msgFileInPlaySelected : st::msgFileInPlay);
return &(selected ? st::historyFileInPlaySelected : st::historyFileInPlay);
} else if (_data->loading()) {
return &(selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel);
}
return &(selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload);
})();
icon->paintInCenter(p, inner);
}
@ -674,13 +675,13 @@ void Document::paint(Painter &p, const QRect &clip, TextSelection selection, con
auto icon = ([showPause, loaded, this, selected] {
if (showPause) {
return &(selected ? st::msgFileInPauseSelected : st::msgFileInPause);
return &(selected ? st::historyFileInPauseSelected : st::historyFileInPause);
} else if (loaded) {
return &(selected ? st::msgFileInPlaySelected : st::msgFileInPlay);
return &(selected ? st::historyFileInPlaySelected : st::historyFileInPlay);
} else if (_data->loading()) {
return &(selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel);
}
return &(selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload);
})();
icon->paintInCenter(p, inner);
}
@ -750,9 +751,9 @@ void Document::paint(Painter &p, const QRect &clip, TextSelection selection, con
p.setOpacity(radialOpacity);
auto icon = ([loaded, this, selected] {
if (loaded || _data->loading()) {
return &(selected ? st::msgFileInCancelSelected : st::msgFileInCancel);
return &(selected ? st::historyFileInCancelSelected : st::historyFileInCancel);
}
return &(selected ? st::msgFileInDownloadSelected : st::msgFileInDownload);
return &(selected ? st::historyFileInDownloadSelected : st::historyFileInDownload);
})();
icon->paintInCenter(p, inner);
if (radial) {

View File

@ -666,7 +666,7 @@ void MainWindow::psRefreshTaskbarIcon() {
w->setWindowFlags(::operator|(Qt::Tool, Qt::FramelessWindowHint));
w->setGeometry(x() + 1, y() + 1, 1, 1);
QPalette p(w->palette());
p.setColor(QPalette::Background, st::titleBG->c);
p.setColor(QPalette::Background, st::titleBg->c);
QWindow *wnd = w->windowHandle();
w->setPalette(p);
w->show();

View File

@ -25,9 +25,7 @@ profileBg: windowBg;
profileTopBarHeight: topBarHeight;
profileTopBarBackIconFg: #0290d7;
profileTopBarBackIcon: icon {
{ "topbar_back_arrow", profileTopBarBackIconFg },
};
profileTopBarBackIcon: icon {{ "topbar_back_arrow", profileTopBarBackIconFg }};
profileTopBarBackIconPosition: point(15px, 20px);
profileTopBarBackFont: font(14px);
profileTopBarBackFg: #1485c2;
@ -69,9 +67,7 @@ profileSecondaryButton: RoundButton(profilePrimaryButton) {
textBg: #ffffff;
textBgOver: #f2f7fa;
}
profileAddMemberIcon: icon {
{ "profile_add_member", windowActiveBg, point(20px, 10px) },
};
profileAddMemberIcon: icon {{ "profile_add_member", windowActiveBg, point(20px, 10px) }};
profileAddMemberButton: RoundButton(profileSecondaryButton) {
width: 62px;
icon: profileAddMemberIcon;
@ -89,12 +85,8 @@ profileDropAreaBorderWidth: 3px;
profileDropAreaDuration: 200;
profileDividerFg: windowShadowFg;
profileDividerLeft: icon {
{ "profile_divider_left", profileDividerFg },
};
profileDividerFill: icon {
{ "profile_divider_fill", profileDividerFg },
};
profileDividerLeft: icon {{ "profile_divider_left", profileDividerFg }};
profileDividerFill: icon {{ "profile_divider_fill", profileDividerFg }};
profileBlocksTop: 7px;
profileBlocksBottom: 20px;
@ -143,9 +135,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", #3babe7, point(4px, 3px) }};
profileLimitReachedLabel: flatLabel(labelDefFlat) {
width: 180px;
margin: margins(profileMemberPaddingLeft, 9px, profileMemberPaddingLeft, 6px);
@ -159,8 +149,8 @@ profileReportReasonOther: InputArea(defaultInputArea) {
heightMax: 115px;
}
profileVerifiedCheckPosition: point(-3px, 7px);
profileVerifiedCheckShift: -3px;
profileVerifiedCheck: icon {
{ "profile_verified_star", #4abcf1 },
{ "profile_verified_check", #ffffff, point(4px, 4px) }
{ "profile_verified_star", #4abcf1, point(0px, 7px) },
{ "profile_verified_check", #ffffff, point(4px, 11px) }
};

View File

@ -151,7 +151,7 @@ void CoverWidget::refreshNameGeometry(int newWidth) {
int nameTop = _userpicButton->y() + st::profileNameTop - st::profileNameLabel.margin.top();
int nameWidth = newWidth - infoLeft - st::profileNameLeft;
if (_peer->isVerified()) {
nameWidth -= st::profileVerifiedCheckPosition.x() + st::profileVerifiedCheck.width();
nameWidth -= st::profileVerifiedCheckShift + st::profileVerifiedCheck.width();
}
int marginsAdd = st::profileNameLabel.margin.left() + st::profileNameLabel.margin.right();
_name->resizeToWidth(qMin(nameWidth - marginsAdd, _name->naturalWidth()) + marginsAdd);
@ -207,7 +207,7 @@ void CoverWidget::paintEvent(QPaintEvent *e) {
p.drawTextLeft(_statusPosition.x(), _statusPosition.y(), width(), _statusText);
if (_peer->isVerified()) {
st::profileVerifiedCheck.paint(p, QPoint(_name->x() + _name->width(), _name->y()) + st::profileVerifiedCheckPosition, width());
st::profileVerifiedCheck.paint(p, _name->x() + _name->width() + st::profileVerifiedCheckShift, _name->y(), width());
}
paintDivider(p);

View File

@ -39,9 +39,7 @@ settingsFixedBarClose: IconButton {
opacity: 0.31;
overOpacity: 0.5;
icon: icon {
{ "settings_close", #000000, point(0px, 0px) },
};
icon: icon {{ "settings_close", #000000, point(0px, 0px) }};
iconPosition: point(20px, 20px);
downIconPosition: point(20px, 20px);

View File

@ -40,9 +40,7 @@ featuredStickersAdd: RoundButton(defaultActiveButton) {
stickerEmojiSkip: 5px;
stickersAddIcon: icon {
{ "stickers_add", #ffffff },
};
stickersAddIcon: icon {{ "stickers_add", #ffffff }};
stickersAddSize: size(30px, 24px);
stickersFeaturedHeight: 32px;
@ -55,6 +53,4 @@ stickersFeaturedUnreadBg: msgFileInBg;
stickersFeaturedUnreadSize: 5px;
stickersFeaturedUnreadSkip: 5px;
stickersFeaturedUnreadTop: 7px;
stickersFeaturedInstalled: icon {
{ "mediaview_save_check", #40ace3 }
};
stickersFeaturedInstalled: icon {{ "mediaview_save_check", #40ace3 }};

View File

@ -32,7 +32,7 @@ SysBtn::SysBtn(QWidget *parent, const style::sysButton &st, const QString &text)
, _a_color(animation(this, &SysBtn::step_color))
, _overLevel(0)
, _text(text) {
int32 w = _st.size.width() + (_text.isEmpty() ? 0 : ((_st.size.width() - _st.img.pxWidth()) / 2 + st::titleTextButton.font->width(_text)));
int32 w = _st.size.width() + (_text.isEmpty() ? 0 : ((_st.size.width() - _st.icon.width()) / 2 + st::titleTextButton.font->width(_text)));
resize(w, _st.size.height());
setCursor(style::cur_default);
connect(this, SIGNAL(stateChanged(int, ButtonStateChangeSource)), this, SLOT(onStateChange(int, ButtonStateChangeSource)));
@ -40,7 +40,7 @@ SysBtn::SysBtn(QWidget *parent, const style::sysButton &st, const QString &text)
void SysBtn::setText(const QString &text) {
_text = text;
int32 w = _st.size.width() + (_text.isEmpty() ? 0 : ((_st.size.width() - _st.img.pxWidth()) / 2 + st::titleTextButton.font->width(_text)));
int32 w = _st.size.width() + (_text.isEmpty() ? 0 : ((_st.size.width() - _st.icon.width()) / 2 + st::titleTextButton.font->width(_text)));
resize(w, _st.size.height());
}
@ -64,7 +64,7 @@ void SysBtn::onStateChange(int oldState, ButtonStateChangeSource source) {
void SysBtn::paintEvent(QPaintEvent *e) {
Painter p(this);
int x = width() - ((_st.size.width() + _st.img.pxWidth()) / 2), y = (height() - _st.img.pxHeight()) / 2;
int x = width() - ((_st.size.width() + _st.icon.width()) / 2), y = (height() - _st.icon.height()) / 2;
QColor c = a_color.current();
if (_overLevel > 0) {
if (_overLevel >= 1) {
@ -75,13 +75,13 @@ void SysBtn::paintEvent(QPaintEvent *e) {
c.setBlueF(c.blueF() * (1 - _overLevel) + _st.overColor->c.blueF() * _overLevel);
}
}
p.fillRect(x, y, _st.img.pxWidth(), _st.img.pxHeight(), c);
p.drawSprite(QPoint(x, y), _st.img);
p.fillRect(x, y, _st.icon.width(), _st.icon.height(), c);
_st.icon.paint(p, x, y, width());
if (!_text.isEmpty()) {
p.setFont(st::titleTextButton.font->f);
p.setPen(c);
p.drawText((_st.size.width() - _st.img.pxWidth()) / 2, st::titleTextButton.textTop + st::titleTextButton.font->ascent, _text);
p.drawText((_st.size.width() - _st.icon.width()) / 2, st::titleTextButton.textTop + st::titleTextButton.font->ascent, _text);
}
}

View File

@ -101,7 +101,7 @@ TitleWidget::TitleWidget(MainWindow *window) : TWidget(window)
void TitleWidget::paintEvent(QPaintEvent *e) {
Painter p(this);
p.fillRect(QRect(0, 0, width(), st::titleHeight), st::titleBG->b);
p.fillRect(QRect(0, 0, width(), st::titleHeight), st::titleBg);
if (!_cancel.isHidden()) {
p.setPen(st::titleTextButton.color->p);
p.setFont(st::titleTextButton.font->f);